-
Here is a quick repo I've created to demonstrate the issue: https://github.com/Simpleqode/bootstrap-5-webpack-test. Basically I have a simple webpack config file with two endpoints one of which imports the whole of Bootstrap, while the second one imports only the Dropdown component to do some magic later. I have Split Chunks plugin in place to move the shared code to a separate file (though the problem persists even if I disable the Split Chunks plugin). index.js:
dropdown.js:
webpack.config.js:
If you try to run |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Simpleqode, Here you're importing the standalone Bootstrap (without Popper.js inside), that's the reason why your Dropdown doesn't work. To make it work just install Popper.js in your project by doing: |
Beta Was this translation helpful? Give feedback.
-
I had the same issue and the suggestion installing popper didn't work for me. Instead, I defined bootstrap as an external and included it manually. Here are more details: https://stackoverflow.com/questions/78876298/webpack-bootstrap-multiple-bundles-cause-bootstrap-js-to-not-work/78880172#78880172 |
Beta Was this translation helpful? Give feedback.
Hi @Simpleqode,
Here you're importing the standalone Bootstrap (without Popper.js inside), that's the reason why your Dropdown doesn't work.
To make it work just install Popper.js in your project by doing:
npm i --save [email protected]