diff --git a/scripts/build.sh b/scripts/build.sh index 1f37445d86c..fe5b4e53775 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -15,7 +15,7 @@ echo 'Done.' echo '' echo 'Build ES modules...' -NODE_ENV=es babel src --out-dir es --ignore 'src/**/*/fixtures,src/**/*.spec.js' +NODE_ENV=es babel src --out-dir es --ignore 'src/**/*.spec.js' echo 'Done.' echo '' diff --git a/scripts/rollup.config.esm.js b/scripts/rollup.config.esm.js deleted file mode 100644 index 8d398854917..00000000000 --- a/scripts/rollup.config.esm.js +++ /dev/null @@ -1,34 +0,0 @@ -import fs from 'fs' -import path from 'path' -import babel from 'rollup-plugin-babel' -import resolve from 'rollup-plugin-node-resolve' -import commonjs from 'rollup-plugin-commonjs' -import css from 'rollup-plugin-css-porter' -import { name, dependencies } from '../package.json' - -const base = path.resolve(__dirname, '..') -const src = path.resolve(base, 'src') -const dist = path.resolve(base, 'dist') - -// Ensure dist directory exists -if (!fs.existsSync(dist)) { - fs.mkdirSync(dist) -} - -export default { - input: path.resolve(src, 'index.js'), - external: Object.keys(dependencies), - plugins: [ - css({ dest: path.resolve(dist, `${name}.css`) }), - resolve({ external: ['vue'] }), - commonjs(), - babel() - ], - output: [ - { - format: 'es', - file: path.resolve(dist, `${name}.esm.js`), - sourcemap: true - } - ] -} diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index 18d6ae82999..2b79ab515e5 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -14,13 +14,14 @@ const externals = ['vue', ...Object.keys(dependencies)] // Libs in `external` will not be bundled to dist, // since they are expected to be provided later. -// We want to include some of them in the build, so we exclude it here. +// In some cases, wee want to include some of them in the build, so we +// exclude the external here. const externalExcludes = ['popper.js', 'vue-functional-data-merge'] // The base rollup configuration const baseConfig = { input: path.resolve(src, 'index.js'), - external: Object.keys(dependencies), + external: externals, plugins: [resolve({ external: ['vue'] }), commonjs(), babel({ exclude: 'node_modules/**' })] } @@ -57,10 +58,9 @@ export default [ } }, - // ES + // ESM { ...baseConfig, - external: ['vue'], output: { format: 'es', file: path.resolve(dist, `${name}.esm.js`),