-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
How are non-ES6 node_modules imported? #16
Comments
6to5 has a commonInterop module formatter which in 2.0.0 is going to be the default. You can pass this option to 6to5 like so: browserify().transform(to5ify.configure({ modules: "commonInterop" })); or $ browserify -t [ 6to5ify --modules commonInterop ] |
For those of you who find this later and want to know more... this is what I ended up with using Gulp:
|
@ruswerner |
@sebmck It certainly does work as an array: when using
this
becomes this
Whereas when using this:
it becomes this
Did I find a bug? |
@sebmck OK. So I traced through the 6to5 code and you are correct in thinking how this could possibly work. It doesn't make sense, however in nodejs, this happens:
I have been writing JavaScript for a long time and had no idea this works; it's either a typecasting bug, or something else about JS that makes no sense. |
Ah yeah, that'e make sense. It's type casting toString because only all On Thursday, 18 December 2014, ruswerner notifications@github.com wrote:
Sebastian McKenzie |
I would like to do this:
However it gets compiled down to:
...which of course is undefined since that node module doesn't export "default".
Is there a way to use the ES6 syntax and have the compiled output drop the
["default"]
?The text was updated successfully, but these errors were encountered: