Ignoring errors on some files
Rush opened this issue · comments
I am trying to build my project with ng-annotate as out of the filters. The problem is that some of the files are written in ES6.
I get the following error from such a file:
{ [Error: services/billingService.js: error: couldn't process source due to parse error
'import' and 'export' may appear only with 'sourceType: module' (1:0)]
message: 'services/billingService.js: error: couldn\'t process source due to parse error\n\'import\' and \'export\' may appear only with \'sourceType: module\' (1:0)',
showStack: false,
showProperties: true,
plugin: 'gulp-ng-annotate',
__safety: { toString: [Function: bound ] } }
Is there a way to simply skip ngAnnotate for this file, for example by ignoring this error and making gulp continue?
Or, if I understand the issue correctly, you may want to use something like gulp-if to process different sets of files with different plugins.
Unfortunately there is no gulp-if
that can help cause ES5 and ES6 files have the same file extension. The only way to tell that it is ES6 is that when ngAnnotate()
fails in parsing. Unfortunately when it fails and I handle the error (even with gulp-plumber
), the file is not being forwarded to the next pipe.
Unfortunately there is no gulp-if that can help cause ES5 and ES6 files have the same file extension
Then, possible solutions would be to put them in different folders or add extra prefix/suffix manually or transpile your sources to ES5 as recommended here.