-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Pack Popper.js to the main JS file #23694
Comments
|
With Browserify / ES6 modules, you need to require / import Popper from within the Bootstrap JS. If you import it from your app script, it'll only be accessible to that script. |
Personally I think the popper.js dependency is a big mistake. Its tripped a few folks I know now and up until today I couldnt quite figure it out. If it cant be integrated in, perhaps at least some documentation in the getting started section on how to include the UMD version (I think? Thats how I managed to blunder into getting it to work) of popper.js to make stuff work again, because as it stands, its pretty damn confusing. |
@Johann-S How do I achieve that? @TechDavid So I need to import @shayneoAtNorwood I totally agree. I'd really like Bootstrap to simply include |
@SamThilmany of course, this is not good practice within the context of node modules. With Johann's suggestion, you could do something like the following:
And then Bootstrap would be able to access the jQuery and Popper variables. |
@TechDavid Thanks for this idea, but unfortunately it doesn't seem to work. I get the following error
If I include jQuery in the HTML in an extra script tag, the error changes to:
The file I'm compiling with Maybe my gulp task is not correct?!
Please note, that I'm separating the In my
|
I haven't tested the code I suggested, so I'm not sure if it would work or not for sure. But maybe Bootstrap can't access the global window when imported with Browserify... to be honest I can't really help you because I don't know enough about Babel and Browserify, sorry. But FYI: this issue has been assigned to a core member, so they are definitely going to fix it, and the next version is also going to remove the jQuery dependency, so all the JS will be in one file. |
@TechDavid Okay, that's nice to know. Thank you for your help anyway. |
Closed thanks to this PR (#23735) which include Popper.js inside Bootstrap, so in our next release use |
That seems like a perfect solution to me @Johann-S |
I am installing popper using npm install popper.js@1.11.0 --save but I can't find the file to include it in my html? |
I notice in the official docs for Bootstrap v4, Popper.js is listed as a dependency. Is Popper.js currently shipped with Bootstrap v4, or do I need to find a way to include it? Thanks for any assistance/recommendations! |
Popper.js is both packaged with Bootstrap in an optional bundle AND is a dependency for the non-bundled version |
I'm using the ES6 import syntax to import
bootstrap
andpopper.js
but I always get the error message, thatBootstrap
needspopper.js
as a dependency. This happens becausepopper.js
is loaded afterbootstrap
.Changing the input oder in the
js
file does not help.How can I set
popper.js
as a dependency forbootstrap
?PS: I'm using
browserify
to handle the packaging.The text was updated successfully, but these errors were encountered: