const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'
-let fileDest = `bootstrap${ESM ? '.esm' : ''}.js`
-const indexPath = ESM ? '../js/index.esm.js' : '../js/index.umd.js'
+let fileDest = `bootstrap${ESM ? '.esm' : ''}`
const external = ['popper.js']
const plugins = [
babel({
}
if (BUNDLE) {
- fileDest = `bootstrap${ESM ? '.esm' : ''}.bundle.js`
+ fileDest += '.bundle'
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['popper.js']
}
const rollupConfig = {
- input: path.resolve(__dirname, indexPath),
+ input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
output: {
banner,
- file: path.resolve(__dirname, `../dist/js/${fileDest}`),
+ file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
format: ESM ? 'esm' : 'umd',
globals
},