diff --git a/babel.config.js b/babel.config.js index b1fdd8e..39599a2 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,15 +1,17 @@ module.exports = { - "plugins": ["@babel/plugin-syntax-dynamic-import"], - "env": { - "test": { - "plugins": ["dynamic-import-node"], - "presets": [ - [ "@babel/env", { + env: { + test: { + plugins: [ + '@babel/plugin-syntax-dynamic-import', + 'dynamic-import-node' + ], + presets: [ + [ '@babel/preset-env', { targets: { - node: "current" + node: 'current' } }] - ] + ], } - }, + } } diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index 70a2f18..bb4645a 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -18,6 +18,18 @@ const banner = `/** */ ` +const babelConfig = () => ({ + presets: [ + ['@babel/preset-env', { + targets: { + node: 8, + ie: 9, + safari: '5.1' + } + }] + ] +}) + function rollupConfig({ plugins = [], ...config @@ -50,8 +62,9 @@ function rollupConfig({ plugins: [ json(), nodeResolve(), + replace(replaceConfig), commonjs(), - replace(replaceConfig) + babel(babelConfig()), ].concat(plugins), }) } @@ -61,10 +74,7 @@ export default [ { output: { file: pkg.web, - }, - plugins: [ - babel() - ] + } }, // minimized umd web build { @@ -72,7 +82,6 @@ export default [ file: pkg.web.replace('.js', '.min.js'), }, plugins: [ - babel(), terser() ] }, @@ -83,9 +92,6 @@ export default [ file: pkg.main, format: 'cjs' }, - plugins: [ - babel() - ], external: Object.keys(pkg.dependencies) }, // esm build @@ -95,9 +101,6 @@ export default [ file: pkg.web.replace('.js', '.esm.js'), format: 'es' }, - plugins: [ - babel() - ], external: Object.keys(pkg.dependencies) }, // browser esm build