Closed MattNguyen closed 8 years ago
Standard protocol for npm modules is to expose an ES5 CJS module in main. Thus, the expectation is that the dependency should not need to be babelified, which is why it's expected that a module should have to manually declare that it needs to be babelified if needed.
So my recommendation is that any dependencies expose ES5 to begin with. If that's not acceptable, can you create an example repo that demonstrates how the babelify plugin doesn't work with ember-browserify?
Also, what specific 3rd party packages are ES6 and require being babelified?
Thanks for your response.
I made a test app here:
https://github.com/MattNguyen/babel-browserify
The test repo uses jsonwebtoken
, which uses jws
. jws
uses es6, for example, here.
Sorry I was on vacation and am currently sick. Will try to get to this later this week.
@MattNguyen once I fixed the jQuery version problem, the test app seems to work for me. I get a token like: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiL..."
@asakusuma - sorry for the delay and thanks for your response.
What was the jQuery version problem?
Also, did you check on a browser that doesn't support es6? When I test the build against IE 10, it fails. You can verify this by grepping for const
in dist/vendor.js
.
Issue was that version of jQuery specified conflicted with what was required by other modules.
I ran it on chrome, so I'll look at the code next time when I get a chance.
Issue was that version of jQuery specified conflicted with what was required by other modules.
^, seems like not an issue with this project. Will reopen if i am not correct.
My issue specifically relates to transpiling
node_modules
packages with babelify.Currently browserify does not transform
node_modules
packages by default.https://github.com/babel/babelify/issues/38, https://github.com/babel/babelify/issues/44, and https://github.com/babel/babelify/issues/53 suggest adding the following to each
node_modules
package.json:Unless I'm mistaken, this doesn't appear to work with
ember-browserify
and simply adding that toconfig/environment.js
does not work either. Regardless, it seems unrealistic to have to add the aforementioned option to each third party package.Does anyone have any suggestions to resolve this?
Thanks in advance!