I'm using a single .babelrc
config and using it in webpack.config.client.js
and webpack.config.server.js
with babel-loader.
.babelrc:
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"debug": false,
"modules": false,
"loose": true
}
],
"@babel/react"
],
"env": {
"development": {
"plugins": ["react-hot-loader/babel"]
},
"production": {}
}
}
The problem is, react-hot-loader find it's way into compiled server code. I did some research and I see that babel 7 allows to configure overrides for such case.
I tried to implement it, but the "env" part never gets overridden:
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"debug": false,
"modules": false,
"loose": true
}
],
"@babel/react"
],
"env": {
"development": {
"plugins": ["react-hot-loader/babel"]
},
"production": {}
},
"overrides": {
"include": "./src/server/index.js", // ?
"env": {
"development": {
"plugins": []
}
}
}
}
Appreciate any help