1- // rollup.config.js
2- import fs from 'fs' ;
31import vue from 'rollup-plugin-vue' ;
42import commonjs from '@rollup/plugin-commonjs' ;
53import resolve from '@rollup/plugin-node-resolve' ;
@@ -9,16 +7,6 @@ import PostCSS from 'rollup-plugin-postcss';
97import { terser } from 'rollup-plugin-terser' ;
108import minimist from 'minimist' ;
119
12- // Get browserslist config and remove ie from es build targets
13- const esbrowserslist = fs
14- . readFileSync ( './.browserslistrc' )
15- . toString ( )
16- . split ( '\n' )
17- . filter ( ( entry ) => entry && entry . substring ( 0 , 2 ) !== 'ie' ) ;
18-
19- // Extract babel preset-env config, to combine with esbrowserslist
20- const babelPresetEnvConfig = { } ;
21-
2210const argv = minimist ( process . argv . slice ( 2 ) ) ;
2311
2412const baseConfig = {
@@ -47,7 +35,6 @@ const baseConfig = {
4735 babel : {
4836 exclude : 'node_modules/**' ,
4937 extensions : [ '.js' , '.jsx' , '.ts' , '.tsx' , '.vue' ] ,
50- babelHelpers : 'bundled' ,
5138 } ,
5239 } ,
5340} ;
@@ -72,20 +59,13 @@ if (!argv.format || argv.format === 'es') {
7259 } ,
7360 plugins : [
7461 replace ( baseConfig . plugins . replace ) ,
75- // ...baseConfig.plugins.preVue,
7662 vue ( baseConfig . plugins . vue ) ,
7763 ...baseConfig . plugins . postVue ,
7864 babel ( {
7965 ...baseConfig . plugins . babel ,
80- presets : [
81- [
82- '@babel/preset-env' ,
83- {
84- ...babelPresetEnvConfig ,
85- targets : esbrowserslist ,
86- } ,
87- ] ,
88- ] ,
66+ babelHelpers : 'runtime' ,
67+ plugins : [ '@babel/plugin-transform-runtime' ] ,
68+ presets : [ [ '@babel/preset-env' ] ] ,
8969 } ) ,
9070 terser ( {
9171 output : {
@@ -114,7 +94,7 @@ if (!argv.format || argv.format === 'cjs') {
11494 // ...baseConfig.plugins.preVue,
11595 vue ( baseConfig . plugins . vue ) ,
11696 ...baseConfig . plugins . postVue ,
117- babel ( baseConfig . plugins . babel ) ,
97+ babel ( { ... baseConfig . plugins . babel , babelHelpers : 'bundled' } ) ,
11898 terser ( {
11999 output : {
120100 ecma : 5 ,
@@ -142,7 +122,7 @@ if (!argv.format || argv.format === 'iife') {
142122 // ...baseConfig.plugins.preVue,
143123 vue ( baseConfig . plugins . vue ) ,
144124 ...baseConfig . plugins . postVue ,
145- babel ( baseConfig . plugins . babel ) ,
125+ babel ( { ... baseConfig . plugins . babel , babelHelpers : 'bundled' } ) ,
146126 terser ( {
147127 output : {
148128 ecma : 5 ,
0 commit comments