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,
|
|
|
|
}],
|
2019-03-25 22:01:57 +08:00
|
|
|
'@babel/plugin-proposal-optional-catch-binding',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
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',
|
2019-03-25 22:01:57 +08:00
|
|
|
'@babel/plugin-proposal-optional-catch-binding',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
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',
|
2019-03-25 22:01:57 +08:00
|
|
|
'@babel/plugin-proposal-optional-catch-binding',
|
2019-03-15 11:42:41 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
})[api.env()]
|