2018-09-24 10:36:08 +08:00
|
|
|
module.exports = api => ({
|
2019-03-15 11:42:41 +08:00
|
|
|
production: {
|
|
|
|
presets: [
|
|
|
|
['@babel/preset-env', {
|
|
|
|
useBuiltIns: false,
|
|
|
|
loose: true,
|
|
|
|
}],
|
2019-03-17 21:09:46 +08:00
|
|
|
'@babel/preset-typescript',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
|
|
['@babel/plugin-transform-runtime', {
|
|
|
|
helpers: true,
|
|
|
|
regenerator: true,
|
|
|
|
}],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
development: {
|
|
|
|
presets: [
|
|
|
|
['@babel/preset-env', {
|
|
|
|
targets: { esmodules: true },
|
|
|
|
}],
|
2019-03-17 21:09:46 +08:00
|
|
|
'@babel/preset-typescript',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
presets: [
|
|
|
|
['@babel/preset-env', {
|
|
|
|
targets: { node: 'current' },
|
|
|
|
}],
|
2019-03-17 21:09:46 +08:00
|
|
|
'@babel/preset-typescript',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
'babel-plugin-dynamic-import-node',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
})[api.env()]
|