diff options
| author | XhmikosR <[email protected]> | 2023-08-06 07:37:24 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-06 07:37:24 +0300 |
| commit | 56664e0caa09fe49c6a17ffd9c21909b2380a8a8 (patch) | |
| tree | 3280d547c26dd94532703c7e634add9c5d845622 /build/rollup.config.js | |
| parent | 0fe3dd93f26187cf7f6fd8df38fc3e9348ca2fd0 (diff) | |
| download | bootstrap-56664e0caa09fe49c6a17ffd9c21909b2380a8a8.tar.xz bootstrap-56664e0caa09fe49c6a17ffd9c21909b2380a8a8.zip | |
Convert build scripts to ESM (#38984)
Diffstat (limited to 'build/rollup.config.js')
| -rw-r--r-- | build/rollup.config.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/build/rollup.config.js b/build/rollup.config.js deleted file mode 100644 index f01918ebf..000000000 --- a/build/rollup.config.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict' - -const path = require('node: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 fileDestination = `bootstrap${ESM ? '.esm' : ''}` -const external = ['@popperjs/core'] -const plugins = [ - babel({ - // Only transpile our source code - exclude: 'node_modules/**', - // Include the helpers in the bundle, at most one copy of each - babelHelpers: 'bundled' - }) -] -const globals = { - '@popperjs/core': 'Popper' -} - -if (BUNDLE) { - fileDestination += '.bundle' - // Remove last entry in external array to bundle Popper - external.pop() - delete globals['@popperjs/core'] - plugins.push( - replace({ - 'process.env.NODE_ENV': '"production"', - preventAssignment: true - }), - nodeResolve() - ) -} - -const rollupConfig = { - input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`), - output: { - banner: banner(), - file: path.resolve(__dirname, `../dist/js/${fileDestination}.js`), - format: ESM ? 'esm' : 'umd', - globals, - generatedCode: 'es2015' - }, - external, - plugins -} - -if (!ESM) { - rollupConfig.output.name = 'bootstrap' -} - -module.exports = rollupConfig |
