mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-24 14:13:06 +02:00
Create a bundled release of Bootstrap with Popper.js inside
This commit is contained in:
43
build/rollup.config.js
Normal file
43
build/rollup.config.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const path = require('path')
|
||||
const babel = require('rollup-plugin-babel')
|
||||
const resolve = require('rollup-plugin-node-resolve')
|
||||
const BUNDLE = process.env.BUNDLE === 'true'
|
||||
|
||||
var fileDest = 'bootstrap.js'
|
||||
var external = ['jquery', 'popper.js']
|
||||
const plugins = [
|
||||
babel({
|
||||
exclude: 'node_modules/**', // only transpile our source code
|
||||
externalHelpersWhitelist: [ // include only required helpers
|
||||
'typeof',
|
||||
'classCallCheck',
|
||||
'createClass',
|
||||
'inherits',
|
||||
'possibleConstructorReturn'
|
||||
]
|
||||
})
|
||||
]
|
||||
const globals = {
|
||||
jquery: '$',
|
||||
'popper.js': 'Popper'
|
||||
}
|
||||
|
||||
if (BUNDLE) {
|
||||
fileDest = 'bootstrap.bundle.js'
|
||||
// remove last entry in external array to bundle Popper
|
||||
external.pop()
|
||||
delete globals['popper.js']
|
||||
plugins.push(resolve())
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
input: path.resolve(__dirname, '../js/src/index.js'),
|
||||
output: {
|
||||
file: path.resolve(__dirname, `../dist/js/${fileDest}`),
|
||||
format: 'iife'
|
||||
},
|
||||
name: 'bootstrap',
|
||||
external: external,
|
||||
globals: globals,
|
||||
plugins: plugins
|
||||
}
|
Reference in New Issue
Block a user