Move babel config out to its own file
For reasons described within this diff.
This commit is contained in:
parent
203c9c8a7d
commit
1cd9c4ff11
2 changed files with 34 additions and 27 deletions
25
.babelrc
Normal file
25
.babelrc
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"sourceMaps": true,
|
||||||
|
"presets": [
|
||||||
|
["@babel/preset-env", {
|
||||||
|
"targets": {
|
||||||
|
"browsers": [
|
||||||
|
"last 2 versions"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
"@babel/preset-typescript",
|
||||||
|
"@babel/preset-flow",
|
||||||
|
"@babel/preset-react"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
["@babel/plugin-proposal-decorators", {"legacy": true}],
|
||||||
|
"@babel/plugin-proposal-export-default-from",
|
||||||
|
"@babel/plugin-proposal-numeric-separator",
|
||||||
|
"@babel/plugin-proposal-class-properties",
|
||||||
|
"@babel/plugin-proposal-object-rest-spread",
|
||||||
|
"@babel/plugin-transform-flow-comments",
|
||||||
|
"@babel/plugin-syntax-dynamic-import",
|
||||||
|
"@babel/plugin-transform-runtime"
|
||||||
|
]
|
||||||
|
}
|
|
@ -93,34 +93,16 @@ module.exports = (env, argv) => ({
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
// We have the babel config here rather than a file to help
|
|
||||||
// make it clearer what we're compiling to.
|
|
||||||
cacheDirectory: true,
|
cacheDirectory: true,
|
||||||
sourceMaps: true,
|
|
||||||
presets: [
|
// These two options are needed to load the babelrc file and
|
||||||
["@babel/preset-env", {
|
// apply it to node_modules (ie: react-sdk and js-sdk). We
|
||||||
"targets": {
|
// could put the babel config in this block instead, but we
|
||||||
"browsers": [
|
// publish riot-web to npm for some reason and that seems to
|
||||||
"last 2 versions",
|
// ship a lib directory. Therefore, we need the babel config
|
||||||
]
|
// in a place where babel and babel-loader can reach it.
|
||||||
},
|
babelrc: true,
|
||||||
}],
|
configFile: path.resolve(__dirname, ".babelrc"),
|
||||||
"@babel/preset-typescript",
|
|
||||||
"@babel/preset-flow",
|
|
||||||
"@babel/preset-react",
|
|
||||||
],
|
|
||||||
plugins: [
|
|
||||||
// Most of these plugins are for the react-sdk to make itself
|
|
||||||
// work correctly.
|
|
||||||
["@babel/plugin-proposal-decorators", {"legacy": true}],
|
|
||||||
"@babel/plugin-proposal-export-default-from",
|
|
||||||
"@babel/plugin-proposal-numeric-separator",
|
|
||||||
"@babel/plugin-proposal-class-properties",
|
|
||||||
"@babel/plugin-proposal-object-rest-spread",
|
|
||||||
"@babel/plugin-transform-flow-comments",
|
|
||||||
"@babel/plugin-syntax-dynamic-import",
|
|
||||||
"@babel/plugin-transform-runtime"
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue