-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Make target browsers configurable #892
Comments
cc @hzoo |
👍 and FYI we have babel/babel-preset-env#19 in progress as an option already so that's a start 😄 |
Omg that's so cool. Wow. I'm excited. |
I think I got the data layer correct (mostly) so it's just on all of us to make sure that the data in https://kangax.github.io/compat-table/es6/ is correct (please check + make PRs to change this) - example I updated the table for node in compat-table/compat-table#932 Good if we get a lot of testing/eyes through usage. There might be some issues with not compiling some features while compilng others but we'll just have to find those and fix them |
This is a step backwards for SSR and universal JS in general. Node is a very valid target for React applications and this proposal completely ignores that fact. You (CRA and Babel) should strip the query parser from browserslist and query kangax instead of caniuse. (Now I have to go and read the Yarn announcement.) |
Sorry, I don't quite understand your comment.
This is "Create React App" repo. The project explicitly does not support server rendering, nor does it intend to. Why is this a "step back" when server rendering is not supported by it? If CRA supported Node, we'd detect Node environment exactly the same way. In fact we already do for tests: #878. So I still don't see why this would pose a problem even for people who eject and want to add server rendering. The "browsers" field would not somehow make this code executable only by the browsers 😉 . It just lets us infer target environments as a moving target instead of assuming ES5 as a base. And tools like Could you please explain more? |
Oh, I'm sorry. I mistakenly thought CRA's view of SSR was changed from "no intent" to "some intent". Don't mind my comment then. |
Merged babel/babel-preset-env#19 and release 0.0.6 with "browsers" in the config |
Right now Browserslist already have a It has no development/production versions and doesn’t support section in We could add both features if it is really necessary :). |
@ai The separation between dev/prod is important to us but I'd be happy to just keep it as part of CRA itself. If you'd like, you could adopt it, but then you'd have to figure out a conventional way to determine which config should be chosen which is tricky. In case of CRA we know this unambiguously because we have separate commands for running app in dev and prod. Reading |
It is hard to make it CRA-only but use in other user tools. Like when user add Stylelint, it will not share common config from Why |
Isn't it possible to pass the desired list to
This would let people transpile less in development because they can specify they develop on modern browsers. Both Babel and Autoprefixer would do less work and produce cleaner output, but for production they'd do the more conservative transformations. |
OK, I think I get it now.
Fair enough, but then this is the case now as well, where Maybe
notation and accept If it is not specified, all rules are summed up ( |
Browserslist format now is very easy. For compatibility we could suggests:
So you suggests to have production and development to keep development build cleaner? But is it a good practice. In my experience development should be as much as closer to production. Only real slow tasks (like minification) should be moved to production. For example, nobody asked Autoprefixer for development browsers list. Because extra prefixes could potentially change something. |
Just production/development distinction would work fine for us. |
Sure, I will add You didn't answered why it is a good practice 😉. I think it is very dangerous to have different environment. I could add it. But I want some rational reasons. I afraid that different environments will saves us a few milliseconds, but will increase production errors, which we could not debug in development. |
Issue about |
Issue about node.js versions support: browserslist/browserslist#75 |
I don't have numbers before and after so I'd be thrilled if somebody could compile them, but I expect wins from disabling most ES2015 transforms to be substantial. The class transform output is also extremely noisy, and annoying to React users. We use Babel in non-loose mode which is pretty conservative. Babel 6 has also been out for a while, and the vast majority of bugs has been squashed since. My opinion is that this is safe enough to go as an opt-in option. |
This should definetely be true because we have the Given evergreen browsers support most of ES6 some users have been thinking about only running the import/export transform (me as well). This is why I wanted to make the env preset (it was suggested multiple times very early on babel/babel#272) but the maintenance burden was too high). There are a few cases where turning off transforms will cause bugs because maybe less people are doing that but we should be able to fix those as more people decide to do so. The only big issue is with https://babeljs.io/docs/plugins/transform-object-rest-spread/ which requires the parameters/destructuring transform in certain cases because it isn't isolated enough.
Not 100% since if there is a bug in the plugin that isn't in dev then you won't see it. But I guess that's why we have a stage env usually? |
Does this affect us after #878? Should we explicitly whitelist destructuring? |
OK, if Babel users already use Issue about environments: browserslist/browserslist#76 |
Could you check all that issues? Did I forget something? |
|
It will error out when you use
Sounds like it's my next priority 😛 |
Any news on this ? Chrome Canary is now in version 56 and async/await is here (stable) since v55. |
We currently don't use |
…he browserslist key in package.json which allows developers to set browsers list in queries like "Chrome >= 35", "Firefox >= 38" for both production and development. Autoprefixer which relies on Browserslist will find its config automatically. This PR fixes facebook#2248 and facebook#892
Any updates on this @gaearon, the application I am working on, we only support Chrome, I hope the bundle size will decrease a lot if we have this working |
@mohammedzamakhan it's part of the |
What is the final format will be? Dan originally proposed: "browsers": {
"development": "last 1 version",
"production": "last 2 versions, > 5%"
} Browserslist implementation: "browserslist": {
"development": ["last 1 browser"],
"production": ["last 4 browser"]
} |
Browserslist already implement it. Should we close this issue? Also I can send PR with moving Autoprefixer's browsers from webpack config to package.json template, since we don't recommend |
We need to change how some things work internally first so that it's applied to babel & css. |
Imagine
package.json
like this:The format is the same as browserslist.
Then, we would use this information both for Babel and Autoprefixer.
Autoprefixer already supports this format of browser configuration.
We could teach babel-preset-env to honor it too, or we could write a helper that translates
browserslist
to itstarget
.This would solve #435 with some optional configuration.
It would make rebuilds faster and also make output less mangled without introducing sourcemaps, helping work around #139.
The text was updated successfully, but these errors were encountered: