env presets in .babelrc seem to be ignored starting 6.3.1
See original GitHub issueI’m submitting a bug report
Webpack Version: 1.14.0
Babel Core Version: 6.23.1
Babel Loader Version: 6.3.1
Please tell us about your environment: macOS Sierra 10.12.2
Current behavior: Even when I include the “react” as a presets, with .babelrc like
{
"env": {
"development": {
"presets": ["es2015", "react"],
...
it doesn’t seem to be used, got errors like Module build failed: SyntaxError: Unexpected token (33:2)
complaining about the JSX syntax.
I noticed this is a new behavior in version 6.3.1. With everything else being the same, if one simply npm install babel-loader 6.3.0, the error will be gone.
Also note that the non-environment specific settings are fine, for example, .babelrc like this works:
{
"presets": ["es2015", "react"],
"env": {
"development": {
...
Expected/desired behavior: The presets specified in the “env” section in .babelrc are used.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top Results From Across the Web
babel/preset-env
babel /preset-env` is a smart preset that allows you to use the latest JavaScript ... (ignoring browsers without security updates like IE 10...
Read more >@babel/preset-env | Yarn - Package Manager
A Babel preset for each environment. readme. babel. The compiler for writing next generation JavaScript. Gitpod ready-to-code.
Read more >testing - How do you configure babel to run with different ...
If you don't set BABEL_ENV , babel will use the NODE_ENV value. If you don't set either BABEL_ENV nor NODE_ENV , it will...
Read more >@babel/preset-react: Versions | Openbase
babel -generator , babel-parser , babel-preset-env , babel-template ... #12678 fix: start TypePredicate node after returnToken (@JLHwung) ...
Read more >Babel-loader NPM
npm install babel-loader babel-core babel-preset-env webpack. Documentation: Using loaders. Within your webpack configuration object, you'll need to add the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I released 6.3.2 with the fix, I’m still not entirely sure why this happened.
Noticed this as well, where plugins defined in “env” would not have their settings applied, which broke our test setup.
Webpack version: 2.2.1
Babel core version: 6.23.0
Babel loader version: 6.3.1
Please tell us about your environment: Ubuntu 16.04.1 LTS 64-bit
Current behavior: A .babelrc file with different options for different NODE_ENV, for instance
Options for NODE_ENV=coverage and NODE_ENV=test are not applied, leading to errors when root-import and rewire plugins are not applied.
Expected/desired behavior: The presets specified in the “env” section in .babelrc are used.
Workaround: Use babel-loader 6.3.0