Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Bootstrap-version JS generation fixes #548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions build/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,36 @@ const plugins = [
})
]
const globals = {
'@popperjs/core': 'Popper',
'date-fns': 'dateFns'
'@popperjs/core': 'Popper'
}

if (BUNDLE) {
destinationFile += '.bundle'
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['@popperjs/core']
// Remove last entry in external array to bundle dateFns
external.pop()
delete globals['date-fns']
plugins.push(
replace({
'process.env.NODE_ENV': '"production"',
preventAssignment: true,
...BOOTSTRAP && {
'coreui.': 'bs.'
}
}),
nodeResolve()
)
plugins.push(nodeResolve())
}

plugins.push(
replace({
'process.env.NODE_ENV': '"production"',
preventAssignment: true,
...BOOTSTRAP && {
delimiters: ['', ''], // disable word boundaries
'/coreui': '/coreui', // prevents https://coreui.io being replaced with https://bs.io
'coreui.': 'bs.',
'.coreui': '.bs',
'coreui-': 'bs-',
'-coreui': '-bs',
"'coreui'": "'bs'", // key.startsWith('coreui') => key.startsWith('bs')
'coreuiConfig': 'bsConfig', // key.startsWith('coreuiConfig')) => key.startsWith('bsConfig'))
'^coreui': '^bs', // key.replace(/^coreui/, ''); => key.replace(/^bs/, '');
'coreui=': 'bs=', // [data-coreui="navigation"] => [data-bs="navigation"] (workaround for preventAssignment being true)
}
})
)

const rollupConfig = {
input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
output: {
Expand Down