-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Is there any alternatives to global: true to get es6 node_modules compiled? #247
Comments
Facing the same issue here. I followed instructions as described here: https://github.com/babel/babelify#why-arent-files-in-node_modules-being-transformed I'm importing an ES6 module from a node_module. That error gets thrown on the first import/export. it seems like that feature broke. |
I am having the same issue as @Lirumlarum . It works when I add the browserify transform to the When I try adding the
I am able to get
but then I can't get the ignore flag to work:
The above still transforms node_modules. For what it's worth, the Is there something else I should try? |
I think to successfully compile @StupidIncarnate To answer your question, solving the |
Preface
I'm using the browserify api to bundle vendor packages vs the app code itself, so I have two browserify scripts.
Cloned and added here: https://github.com/StupidIncarnate/babelify/tree/api
Everything was working fine until I added material-components-web package. Then it was breaking the vendor generator because I guess it has ES6 exports happening. Error was: SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'
Adding this to the package.json didn't work:
The only way to get it to work was doing global: true in the vendor script, but doing that caused issues with underscore after compiling when you load up the app in the browser:
jashkenas/underscore#2680
So the only way to make that happy was this:
https://github.com/StupidIncarnate/babelify/blob/api/scripts/bundle-vendor.js
Question
Is there any other way to do this? What are the dangers of using global: true, other than having to patch each package that gets installed?
I would ideally not like to have to do ignores because those can get messy and time consuming when they break.
The text was updated successfully, but these errors were encountered: