example:
const mix = require('laravel-mix')
const enforce = true // cover default babel config
mix.babelConfig({
plugins: []
}, enforce)
if enforce equal true ,mix.babelConfig will not merge default config, but just replace it.
Is it feasible?
I'd also like to have this kind of feature.
Babel isn't as configurable as it should be in my opinion.
I have a custom .babelrc where I'd like to target specific browsers.
For example:
{
"presets": [
[
"env",
{
"modules": false,
"targets": {
"chrome": 66
}
}
]
]
}
The merge generates a config that looks like this:
{
"cacheDirectory": true,
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": [
"> 2%"
],
"uglify": true
}
}
],
[
"env",
{
"modules": false,
"targets": {
"chrome": 66
}
}
]
],
"plugins": [
"transform-object-rest-spread",
[
"transform-runtime",
{
"polyfill": false,
"helpers": false
}
]
]
}
which effectively makes the custom config useless for this use case.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
So, this is the end?
The latest version of Mix includes improved Babel config merging.
Great!
Most helpful comment
I'd also like to have this kind of feature.
Babel isn't as configurable as it should be in my opinion.
I have a custom .babelrc where I'd like to target specific browsers.
For example:
The merge generates a config that looks like this:
which effectively makes the custom config useless for this use case.