diff options
Diffstat (limited to '.config/rollup.tests.js')
-rw-r--r-- | .config/rollup.tests.js | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/.config/rollup.tests.js b/.config/rollup.tests.js index e524a79..3620149 100644 --- a/.config/rollup.tests.js +++ b/.config/rollup.tests.js @@ -1,5 +1,33 @@ -import babel from 'rollup-plugin-babel' -import multiEntry from 'rollup-plugin-multi-entry' +import * as pkg from '../package.json' +import babel from '@rollup/plugin-babel' +import multiEntry from '@rollup/plugin-multi-entry' +import resolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' + +const getBabelConfig = (targets) => babel({ + include: ['src/**', 'spec/**/*'], + babelHelpers: 'runtime', + babelrc: false, + presets: [['@babel/preset-env', { + modules: false, + targets: targets || pkg.browserslist, + // useBuildins and plugin-transform-runtime are mutually exclusive + // https://github.com/babel/babel/issues/10271#issuecomment-528379505 + // use babel-polyfills when released + useBuiltIns: false, + // corejs: 3, + bugfixes: true + }]], + plugins: [ + ['@babel/plugin-transform-runtime', { + corejs: 3, + helpers: true, + useESModules: true, + version: "^7.9.6", + regenerator: false + }] + ] +}) export default { input: [ @@ -9,24 +37,13 @@ export default { output: { file: 'spec/es5TestBundle.js', name: 'SVGTests', - sourceMap: true, - format: 'iife' + format: 'iife', }, plugins: [ - babel({ - include: 'src/**', - runtimeHelpers: true, - babelrc: false, - presets: [['@babel/preset-env', { - modules: false - }]] - // plugins: [["@babel/plugin-transform-runtime", { - // corejs: false, - // helpers: true, - // regenerator: true, - // useESModules: true - // }]] - }), + resolve({ browser: true }), + commonjs(), + getBabelConfig(), multiEntry() - ] + ], + external: ['@babel/runtime', '@babel/runtime-corejs3'] } |