-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Revert "remove uneccessary target.browsers (#1004)" #1083
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
Conversation
Strange, I could swear they already fixed this. It also says so in their README:
and there's no open issue about this that I can find. |
The original PR is this one - babel/babel-preset-env#161 and as you can see in babel/babel-preset-env#161 (comment), the feature was landed in |
Hm, that's really inconvenient. We need browserslist in So the middle ground would probably be to import it into babelrc, so we only have to manage it in one place. Would you adjust the PR in that regard? |
Ah damn, babelrc is json, not js.... |
Once Babel 7 lands, you can use a Here's a workaround for 6.x in the meantime. |
Thanks @jarrodldavis, that's very helpful. @LinusBorg I agree that having to define the targets in 2 places is not ideal. However, this issue will be fixed once babel packages are out of beta which I am guessing will be soon. Are you sure you want me to setup |
Hm, I'm a bit torn. But I think this could be advantagous. Once we have a So yeah, let's actually do this. |
This reverts commit 41cb811.
This approach breaks jest 😞
|
Hmm, since |
Tried it, it does not get loaded during testing. |
Hmm, looks like Jest only looks at |
Okay, I've figured it out.
{
"presets": [
["./.babelrc.js"]
],
"env": {
"test": {
"presets": ["./.babelrc.js"]
}
}
}
module.exports = function () {
if (process.env.NODE_ENV === 'test') {
return {
presets: ['env', 'stage-2']
}
} else {
return {
presets: [
['env', {
modules: false
}],
'stage-2'
],
plugins: ['transform-runtime']
}
}
} I also ran |
Thanks @jarrodldavis, that does work. A little concerned about the increased complexity though. |
a5de0df
to
406784a
Compare
Yes, the added complexity is sub-optimal. Having two places to edit broswerslist in is sub-optimal as well, especially if we can't add comments in neither of the two places since both are JSON. So I'd say it's a trade-off that's worth it. We just have to Mae sure to make it worth to the users by offering a well commented babelrc.js |
@sudo-suhas So I've checked this out and I'm sorry to say that I think I've changed my mind again :( I'm a fraid that the new format of the babelrc.js file with the conditional return depending on environment will lead to a lot of confusion for people not familiar with the reasons we did it. So I guess we will have to bite the bullet and revert to having the browserslist in both Would you agree? |
No problem at all 😄. I honestly appreciate the thought you and the rest of Vue.js team put into maintaining and developing the ecosystem 🙇.
I had similar concerns.
Okay, removing a commit is easy enough. Where do you think I should update the docs? |
406784a
to
affdc01
Compare
@sudo-suhas Let's revert the code first and worry about docs in a second step - we currently don't have a section dealing with the Babel setup at all, so I don't think there's a good place to drop in a quick tipp for the user. Maybe in the generated project README? |
I already removed the commit which setup |
(close-reopen to trigger CI) |
* develop: remove unnecessary exceptions bump version to 1.2.6 Add JX support (close #1146) Automatically install Dependencies and fix lint errors (#1133) Set `allChunks: true` by default (close #1110) (#1149) airbnb eslint config compatibility with vuex (#1003) Document babel target env configuration (#1144) Revert "remove uneccessary target.browsers (#1004)" (#1083) fix filename of `.eslintignore` (#1136) webpack.conf.js is not needed in jest and e2e (#1135) # Conflicts: # template/test/e2e/custom-assertions/elementCount.js
* develop: remove unnecessary exceptions bump version to 1.2.6 Add JX support (close vuejs-templates#1146) Automatically install Dependencies and fix lint errors (vuejs-templates#1133) Set `allChunks: true` by default (close vuejs-templates#1110) (vuejs-templates#1149) airbnb eslint config compatibility with vuex (vuejs-templates#1003) Document babel target env configuration (vuejs-templates#1144) Revert "remove uneccessary target.browsers (vuejs-templates#1004)" (vuejs-templates#1083) fix filename of `.eslintignore` (vuejs-templates#1136) webpack.conf.js is not needed in jest and e2e (vuejs-templates#1135) # Conflicts: # template/test/e2e/custom-assertions/elementCount.js
The last released version of
babel-preset-env
does not yet support loading the targets frombrowserslist
field inpackage.json
:I enabled the debug output for
babel-preset-env
in.babelrc
:output after adding targets
However, the targets can be removed from
.babelrc
once@babel/preset-env
is out of beta.