Closed digitalkaoz closed 8 years ago
ES6 support in ng-annotate will only happen if a contributor steps up.
It terms of combining ng-annotate with other tools, you should perform ng-annotate processing after more or less everything else, but before you minify. As long as you use the "ngInject"
form, none of the steps before ng-annotate should strip it away. I can't tell you how to do this with your webpack setup but I'm sure it is possible.
@olov can we then reopen the issue and add a help-wanted
tag please?
There is no open "Add support for ES6 (and ES2016, and..) [contributions-welcome]" issue open because, like so many other things, it's a tradeoff (complexity and more code for someone to maintain).
It seems to me that your particular issue is caused by your current webpack configuration, as I suggested in my previous comment.
It's less about supporting everything from ES6, than to avoid to break on import and export ES6 statements.
I can't tell why this happens, but I confirm the issue of the OP. And changing Babel from es2015-webpack to es2015 will make it working. So it's all about import
and export
which breaks (silently) ngAnnotate for some reasons. That's an issue for everyone using Angular with Webpack.
Btw, this is the error thrown: error: couldn't process source due to parse error, 'import' and 'export' may appear only with 'sourceType: module' (24:0)
it would be nice if ng-annotate support the native es import feature (so we dont have to rely on commonjs modules).
this feature enables us to use tree-shaking (to remove useless code) http://www.2ality.com/2015/12/webpack-tree-shaking.html
also see https://github.com/huston007/ng-annotate-loader/issues/17