bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Bootstrap 5.2 - Any JS dependency changes?

Open chrisreddington opened this issue 3 years ago • 3 comments

Discussed in https://github.com/twbs/bootstrap/discussions/36881

Originally posted by chrisreddington August 2, 2022 Hi Folks,

I wondered if anyone had any issues upgrading from Bootstrap 5.2 to 5.2? I'm aware that there were some changes on the sass side (so have imported the new maps partial), but seem to also be having issues with JavaScript.

I can't see anything called out in the Bootstrap 5.2 migration guide around JavaScript. I had a site with JavaScript that was working in 5.1, and now no longer working in 5.2. I am now seeing Uncaught TypeError: Class extends value undefined is not a constructor or null in my console, which hints to me that there's a dependency issue.

The theme itself for my site is hosted in my hugo creator repository, where you'll notice the example/demo site has the exact same issue (which could imply the issue on my end, and how i'm referencing the files - but haven't quite got that stage of identifying the issue yet!)

I'm referencing the individual files from node_modules, via the js/dist folder. The order that I'm referencing is -

"dom/data.js", "dom/event-handler.js", "dom/manipulator.js", "dom/selector-engine.js", "popper.js", "base-component.js", "carousel.js", "collapse.js", "dropdown.js"

Is there anything that I may need to consider going into 5.2 about the ordering of references for the individual components, or any dependency conflicts with other packages that may have been introduced?

Thanks!

chrisreddington avatar Aug 06 '22 19:08 chrisreddington

You are probably referring to this change. https://github.com/twbs/bootstrap/pull/34509

We were thinking to deprecate the separated format, but as is still being used, I am trying to push a change https://github.com/twbs/bootstrap/pull/36854 which in combination with an esm build would be really handy as module.

For now if you want to move on 5.2. I suppose it would be better to use the dist/js/bootstrap.bundle.js

GeoSot avatar Aug 06 '22 21:08 GeoSot

Thanks @GeoSot - Ironically, I just stumbled upon #34509, then spotted that you responded to this issue, as it was tagged in the PR :)

It might be worth elevating this change into the Migration notes for 5.2. I spotted on the 5.2 Project Board that it notes js/dist is effectively now deprecated. But it took a lot of digging to find that info.

Thanks for the nudge though, much appreciated!

chrisreddington avatar Aug 06 '22 23:08 chrisreddington

For anyone else encountering issues, can confirm that switching to using dist/js/boostrap.bundle.js worked again for me (thanks again @GeoSot).

Less than ideal, as my deploy now contain JS code for components that I am not using, but solves the immediate UI issues.

chrisreddington avatar Aug 06 '22 23:08 chrisreddington

@GeoSot is this something to keep open and take action on, or should we close it out?

mdo avatar Dec 28 '22 00:12 mdo

In case we want to use the independent J's built files, I think we need some small build changes ( I need to check it as I am not able to recall now )

GeoSot avatar Dec 28 '22 07:12 GeoSot