Separate babel configuration file
This commit is contained in:
40
.babelrc
Normal file
40
.babelrc
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{
|
||||||
|
"targets": {
|
||||||
|
"browsers": "last 2 versions"
|
||||||
|
},
|
||||||
|
"useBuiltIns": "usage",
|
||||||
|
"corejs": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@babel/preset-typescript",
|
||||||
|
{
|
||||||
|
"onlyRemoveTypeImports": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@babel/preset-react"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"@babel/plugin-proposal-decorators",
|
||||||
|
{
|
||||||
|
"legacy": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@babel/plugin-proposal-class-properties",
|
||||||
|
{
|
||||||
|
"loose": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"development": {
|
||||||
|
"plugins": ["react-refresh/babel"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,25 +35,7 @@ const config: webpack.Configuration = {
|
|||||||
loader: "babel-loader",
|
loader: "babel-loader",
|
||||||
options: {
|
options: {
|
||||||
cacheDirectory: true,
|
cacheDirectory: true,
|
||||||
babelrc: false,
|
babelrc: true,
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
"@babel/preset-env",
|
|
||||||
{
|
|
||||||
targets: { browsers: "last 2 versions" },
|
|
||||||
useBuiltIns: "usage",
|
|
||||||
corejs: 3,
|
|
||||||
}, // or whatever your project requires
|
|
||||||
],
|
|
||||||
["@babel/preset-typescript", { onlyRemoveTypeImports: true }],
|
|
||||||
"@babel/preset-react",
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
// plugin-proposal-decorators is only needed if you're using experimental decorators in TypeScript
|
|
||||||
["@babel/plugin-proposal-decorators", { legacy: true }],
|
|
||||||
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
||||||
isDevelopment && require.resolve("react-refresh/babel"),
|
|
||||||
].filter(Boolean),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user