Update Babel config

This commit is contained in:
Pig Fang 2018-09-24 10:36:08 +08:00
parent 8ed5ea6fc5
commit ae7639c1d4
4 changed files with 40 additions and 37 deletions

View File

@ -1,29 +0,0 @@
{
"presets": [
["@babel/preset-env", {
"modules": false,
"useBuiltIns": false,
"loose": true
}]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
["@babel/plugin-transform-runtime", {
"helpers": true,
"regenerator": true
}]
],
"env": {
"test": {
"presets": [
["@babel/preset-env", {
"targets": { "node": "current" },
"ignoreBrowserslistConfig": true
}]
],
"plugins": [
"babel-plugin-dynamic-import-node"
]
}
}
}

View File

@ -1,2 +1,4 @@
> 1%
not dead
not ie 11
Chrome > 52

37
babel.config.js Normal file
View File

@ -0,0 +1,37 @@
module.exports = api => ({
production: {
presets: [
['@babel/preset-env', {
useBuiltIns: false,
loose: true
}]
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
['@babel/plugin-transform-runtime', {
helpers: true,
regenerator: true
}]
]
},
development: {
presets: [
['@babel/preset-env', {
targets: { esmodules: true }
}]
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
]
},
test: {
presets: [
['@babel/preset-env', {
targets: { node: 'current' }
}]
],
plugins: [
'babel-plugin-dynamic-import-node'
]
},
})[api.env()];

View File

@ -42,14 +42,7 @@ const config = {
exclude: /node_modules/,
use: [
'cache-loader',
{
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-transform-async-to-generator'
]
}
}
'babel-loader'
]
},
{