aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/build/rollup.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/build/rollup.config.js')
-rw-r--r--vendor/twbs/bootstrap/build/rollup.config.js38
1 files changed, 25 insertions, 13 deletions
diff --git a/vendor/twbs/bootstrap/build/rollup.config.js b/vendor/twbs/bootstrap/build/rollup.config.js
index e2d2b125e..8cecec9aa 100644
--- a/vendor/twbs/bootstrap/build/rollup.config.js
+++ b/vendor/twbs/bootstrap/build/rollup.config.js
@@ -3,12 +3,14 @@
const path = require('path')
const { babel } = require('@rollup/plugin-babel')
const { nodeResolve } = require('@rollup/plugin-node-resolve')
+const replace = require('@rollup/plugin-replace')
const banner = require('./banner.js')
const BUNDLE = process.env.BUNDLE === 'true'
+const ESM = process.env.ESM === 'true'
-let fileDest = 'bootstrap.js'
-const external = ['jquery', 'popper.js']
+let fileDest = `bootstrap${ESM ? '.esm' : ''}`
+const external = ['@popperjs/core']
const plugins = [
babel({
// Only transpile our source code
@@ -18,27 +20,37 @@ const plugins = [
})
]
const globals = {
- jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode
- 'popper.js': 'Popper'
+ '@popperjs/core': 'Popper'
}
if (BUNDLE) {
- fileDest = 'bootstrap.bundle.js'
+ fileDest += '.bundle'
// Remove last entry in external array to bundle Popper
external.pop()
- delete globals['popper.js']
- plugins.push(nodeResolve())
+ delete globals['@popperjs/core']
+ plugins.push(
+ replace({
+ 'process.env.NODE_ENV': '"production"',
+ preventAssignment: true
+ }),
+ nodeResolve()
+ )
}
-module.exports = {
- input: path.resolve(__dirname, '../js/index.js'),
+const rollupConfig = {
+ input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
output: {
banner,
- file: path.resolve(__dirname, `../dist/js/${fileDest}`),
- format: 'umd',
- globals,
- name: 'bootstrap'
+ file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
+ format: ESM ? 'esm' : 'umd',
+ globals
},
external,
plugins
}
+
+if (!ESM) {
+ rollupConfig.output.name = 'bootstrap'
+}
+
+module.exports = rollupConfig