diff options
author | Johann-S <johann.servoire@gmail.com> | 2017-08-29 22:16:00 +0300 |
---|---|---|
committer | Johann-S <johann.servoire@gmail.com> | 2017-08-31 19:43:04 +0300 |
commit | 9936bf59444c402b653f28449529eab83794e911 (patch) | |
tree | 9f92962faffb32135e5d1a3af31176572c359884 /build/rollup.config.js | |
parent | 0165a620ec5826289dd56c0683c413e7a5b47fcb (diff) |
Create a bundled release of Bootstrap with Popper.js inside
Diffstat (limited to 'build/rollup.config.js')
-rw-r--r-- | build/rollup.config.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/build/rollup.config.js b/build/rollup.config.js new file mode 100644 index 0000000000..7cec6ef1cc --- /dev/null +++ b/build/rollup.config.js @@ -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 +} |