Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for webpack2 native es6 import feature #227

Closed
digitalkaoz opened this issue Feb 9, 2016 · 5 comments
Closed

support for webpack2 native es6 import feature #227

digitalkaoz opened this issue Feb 9, 2016 · 5 comments

Comments

@digitalkaoz
Copy link

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 andrey-skl/ng-annotate-loader#17

@olov
Copy link
Owner

olov commented Feb 9, 2016

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 olov closed this as completed Feb 9, 2016
@digitalkaoz
Copy link
Author

@olov can we then reopen the issue and add a help-wanted tag please?

@olov
Copy link
Owner

olov commented Feb 9, 2016

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.

@0cv
Copy link

0cv commented Mar 22, 2016

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.

@0cv
Copy link

0cv commented Mar 22, 2016

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants