After successfully bundling the Bootstrap 5 SCSS files using Grunt, I now want to do the same with the JavaScript files. I am using grunt-contrib-uglify for this task:
uglify: {
site: {
options: {
sourcemap: false
},
files: {
'example/static/example/assets/js/example.min.js': [
// List of JS files to include
'node_modules/@popperjs/core/dist/umd/popper.js',
'node_modules/bootstrap/js/dist/dom/data.js',
'node_modules/bootstrap/js/dist/dom/event-handler.js',
// Add more files here
'example/src/js/**/*.js'
]
}
},
},
After including the minified JS file in my HTML, I encountered an error in the console:
ReferenceError: bootstrap is not defined
I followed the npm bootstrap 5 starter on Github for reference, including all necessary files, such as the Popper dependency and core JS files. However, I seem to be missing something from the bundle. Here is a link to the starter files on Github: Github Bootstrap 5 npm starter
Bootstrap version: 5.1
Popper version: 2.9.2
Edit: The issue was resolved when using the distributed bundle.