How to modify babel-preset-env configuration?
See original GitHub issue- Laravel Mix Version: 1.4.2
- Node Version (
node -v
): v8.4.0 - NPM Version (
npm -v
): 5.3.0 - OS: Mac
Description:
In src/config.js there is:
babel: function () {
let options = {};
tap(Mix.paths.root('.babelrc'), babelrc => {
if (File.exists(babelrc)) {
options = JSON.parse(File.find(babelrc).read());
}
});
let defaultOptions = {
cacheDirectory: true,
presets: [
['env', {
'modules': false,
'targets': {
'browsers': ['> 2%'],
uglify: true
}
}]
]
};
if (this.react) {
defaultOptions.presets.push('react');
}
return webpackMerge.smart(defaultOptions, options);
},
Steps To Reproduce:
In my .babelrc I have
{
"presets": [
["env", {
"targets": {
"browsers": ["> 5%"],
"uglify": false
}
}]
]
}
However, this is just concatenating this as another ‘env’ preset and it isn’t being used. How can I modify the original env preset?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
babel/preset-env
This option configures how @babel/preset-env handles polyfills. When either the usage or entry options are used, @babel/preset-env will add direct references ...
Read more >Presets - Babel.js
Babel presets can act as sharable set of Babel plugins and/or config options . Official Presets. We've assembled a few presets for common...
Read more >Configure Babel
Create a file called babel.config.json with the following content at the root of your project (where the package.json is). ... Check out the...
Read more >babel-preset-es2015 -> babel-preset-env - Babel.js
Babel 7. If you are using Babel version 7 you will need to run npm install @babel/preset-env and have "presets": ["@babel/preset-env"] in your...
Read more >Config Files - Babel.js
Babel can be configured using any file extension natively supported by Node.js, as mentioned in Configuration File Types section: babel.config.json and .babelrc ...
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 FreeTop 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
Top GitHub Comments
This essentially makes Laravel Mix no longer useful for my case as it seems to not be transpiling for IE11 now which clients are still requesting support for. IMO this feature should be pretty high priority - there will always be edge cases where the > 2% target is not appropriate.
Example of update the merge strategy.