mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-30 16:50:00 +02:00
Tweak rollup.config.js
This commit is contained in:
@@ -8,8 +8,7 @@ const banner = require('./banner.js')
|
|||||||
const BUNDLE = process.env.BUNDLE === 'true'
|
const BUNDLE = process.env.BUNDLE === 'true'
|
||||||
const ESM = process.env.ESM === 'true'
|
const ESM = process.env.ESM === 'true'
|
||||||
|
|
||||||
let fileDest = `bootstrap${ESM ? '.esm' : ''}.js`
|
let fileDest = `bootstrap${ESM ? '.esm' : ''}`
|
||||||
const indexPath = ESM ? '../js/index.esm.js' : '../js/index.umd.js'
|
|
||||||
const external = ['popper.js']
|
const external = ['popper.js']
|
||||||
const plugins = [
|
const plugins = [
|
||||||
babel({
|
babel({
|
||||||
@@ -30,7 +29,7 @@ const globals = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BUNDLE) {
|
if (BUNDLE) {
|
||||||
fileDest = `bootstrap${ESM ? '.esm' : ''}.bundle.js`
|
fileDest += '.bundle'
|
||||||
// Remove last entry in external array to bundle Popper
|
// Remove last entry in external array to bundle Popper
|
||||||
external.pop()
|
external.pop()
|
||||||
delete globals['popper.js']
|
delete globals['popper.js']
|
||||||
@@ -38,10 +37,10 @@ if (BUNDLE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rollupConfig = {
|
const rollupConfig = {
|
||||||
input: path.resolve(__dirname, indexPath),
|
input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
|
||||||
output: {
|
output: {
|
||||||
banner,
|
banner,
|
||||||
file: path.resolve(__dirname, `../dist/js/${fileDest}`),
|
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
|
||||||
format: ESM ? 'esm' : 'umd',
|
format: ESM ? 'esm' : 'umd',
|
||||||
globals
|
globals
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user