fix: add tree-shakeable package exports#50
Open
germanocaumo wants to merge 1 commit into
Open
Conversation
Build an ESM output alongside the existing UMD bundle and expose it through the package export map. Add per-component exports while preserving legacy dist/components paths for CommonJS consumers. Also avoid the Modal component importing Button through the root barrel and move tooltip runtime packages into dependencies.
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.
What does this PR do?
Adds a tree-shakeable ESM build for
@mconf/bbb-ui-components-reactand exposes it throughpackage.jsonexports.This PR also:
dist/componentsCommonJS paths available for compatibilityBBBModalimportingBBButtonthrough the root barrelMotivation
BBB plugins that import a small component from the package root currently resolve the bundled UMD entrypoint, which pulls in the whole component library and unused MUI modules.
With the ESM entrypoint, bundlers can tree-shake root imports and include only the components actually used by each plugin.
More
Validated with:
npm run lintnpm run buildnpm packObserved bundle-size impact in simulated consumer builds:
91.6%raw size reduction82.5%gzip size reduction