-
Notifications
You must be signed in to change notification settings - Fork 363
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
Modern JS #413
Modern JS #413
Conversation
Failure is upstream, I've opened an issue on babel-plugin-transform-async-to-promises to report the dead Promise.resolve(). |
@developit Give 0.8.12 a go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been trying out a bunch with the esmodules: true
in babel env as well. What I've been thinking is that we're targetting evergreen browsers. These auto-update most of the time shouldn't something like last x versions (targetting canary, stable and version before) be sufficient for something like modern?
@JoviDeCroock – The issue is defining "modern." The module/nomodule pattern provides the only declarative html driven approach to segmenting functionality. By default module means a lower transpilation ceiling than nomodule, but it's target rapidly decays compared to the next definition of "modern." We need better signals from user-agents. |
@kristoferbaxter are you talking about some server that would sniff the user agent and return the correct index.html (with corresponding bundle)? |
I'm saying that a more pure declarative signal sent via headers is important. But also, for static documents to be able to leverage via mechanisms similar to declarative html treatments for module/nomodule. We can only work with what we have available today – so the most modern you can provide in a statically defined way is module/nomodule. |
Glad to see we're sticking to the syntax.esmodules, built a small webpack plugin when this would go live. 👍 great work @developit really excited about this |
Gotta rebase 👀 Update is already in master |
I should have clarified in my PR description: I view It might be that we decide on "state your syntax and entry", in which case we'd have microbundle generate ES2018 and es5, or steps between the two. |
if i don't set this flag, will preset-env respect the browserlist settings in my package.json? Because it also turns on modules (i am 99% sure) if i force modern browsers by their versions. I use edge last 1 version and ff, chrome and safari last 2 versions + mobile equivalents for ios, ff and chrome the most times. |
@hbroer FWIW it sounds like your browserslist configuration is really really close to |
My understanding of the flag is that it only turns on modules, but everything which is newer than that feature is transpiled. I really have to take a look into that, because this is only what i think i know with a big question mark above my head ^^ I think this would transpiled to
And I would expect it doesn't transpile if I set browserlist to chrome and firefox last versions (and nothing else). |
@hbroer your understanding is correct. I agree it would be nice to have the I think we can improve on this over time, but for now |
Ok sounds fine. Maybe there should be a notice in the readme that it is possible to use browserlist instead of the flag to address browsers directly. |
Yup, we can add that - it actually became possible by accident when we switched to Babel last week! |
This PR adds a new
modern
value for the-formats
/-f
option. Modern output uses thetarget.esmodules
setting from@babel/preset-env
to compile modern output.It might be worth exploring targeting something more like "latest". Would love to hear everyone's thoughts!