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

import bootstrap from 'bootstrap' - "export default was not found" #32642

Closed
demiavaliani opened this issue Dec 28, 2020 · 5 comments · Fixed by #36414
Closed

import bootstrap from 'bootstrap' - "export default was not found" #32642

demiavaliani opened this issue Dec 28, 2020 · 5 comments · Fixed by #36414

Comments

@demiavaliani
Copy link

I have Angular 11 & Bootstrap 5 project.

Following the documentation from here: Package managers > NPM

  1. "import bootstrap from 'bootstrap'" to expose the plugins.

  2. 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.

@lukasjuhrich
Copy link

lukasjuhrich commented Apr 12, 2021

Note also that the official docs concerning how to find out the version number expect you to use the bootstrap.* symbols. In particular, bootstrap-table uses bootstrap.Tooltip.VERSION to determine whether someone uses v5.

I was not aware of the import * as bootstrap from 'bootstrap' workaround and have not been able to try it out.
(Sorry if I mis-use nomenclature, I don't know much about ES6 modules.)

@benkoshy
Copy link
Contributor

benkoshy commented Sep 8, 2021

@mdo is it worth having a default export boostrap object? Or should the documentation be updated directing users to export the specific components they require: e.g. import {Modal} from "bootstrap" - pls LMK - and I can (try to) put in the PR.

@mdo
Copy link
Member

mdo commented May 20, 2022

@GeoSot Any thoughts here beyond what we're doing in our updated guides and #36414?

@negentropicdev
Copy link

Documentation still seems to be incorrect
image

@Gitlit1010
Copy link

Documentation still seems to be incorrect
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants