import bootstrap from 'bootstrap' - "export default was not found"
Created by: demiavaliani
I have Angular 11 & Bootstrap 5 project.
Following the documentation from here: Package managers > NPM
-
"import bootstrap from 'bootstrap'" to expose the plugins.
-
Now having "bootstrap" object, I go ahead and try to get instance of Modal for example:
bootstrap.Modal.getInstance(myModal);
Received following error: "export 'default' (imported as 'bootstrap') was not found in 'bootstrap'
Looks like there is no default export in bootstrap library. Instead import * as bootstrap from 'bootstrap' fixed the issue.
Also, it would be good to have a mention of how to import properly the plugins inside the website Components section itself. For example, Components > Modal > getInstance just mentions that we can get instance of a Modal. But it does not say how to properly import the plugins first.