v5.4.1 - #335
Merged
Merged
v5.4.1#335
Conversation
2 tasks done
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Change Summary
Indicate the type of change being made.
Description
Bug Fix: Tree-shaking removes DOM-initializing side-effects (#334)
This PR fixes an issue where the DOM-initializing side-effect that registers
bootstrapToggleonHTMLInputElement.prototypewas being removed by tree-shaking in ESM/bundler environments (Vite, Webpack, Rollup, etc.).The Problem
When importing the full bundle via
import 'bootstrap5-toggle/js/bootstrap5-toggle.ecmas.js', bundlers would tree-shake the side-effect that patchesHTMLInputElement.prototype.bootstrapToggle. This resulted in:The workaround of
new BootstrapToggle(element)still worked, confirming that only the prototype-patching side-effect was being eliminated.The Fix
sideEffectsinpackage.jsonto mark CSS and JS files as side-effectful:Related Issues
element.bootstrapToggle()when imported via bundlers #334Test Coverage
Indicate whether you have added, modified, fixed, or removed tests.
Documentation Changes
Indicate whether any documentation has been updated.
Note: No documentation updates included in this PR. The fix is internal and does not change the public API.
Additional Notes
Breaking Changes: None - this is a patch release.
Pull Request Checklist