Skip to content

fix: add tree-shakeable package exports#50

Open
germanocaumo wants to merge 1 commit into
bigbluebutton:mainfrom
germanocaumo:fix-size
Open

fix: add tree-shakeable package exports#50
germanocaumo wants to merge 1 commit into
bigbluebutton:mainfrom
germanocaumo:fix-size

Conversation

@germanocaumo

Copy link
Copy Markdown

What does this PR do?

Adds a tree-shakeable ESM build for @mconf/bbb-ui-components-react and exposes it through package.json exports.

This PR also:

  • adds explicit package exports for every component
  • keeps the existing dist/components CommonJS paths available for compatibility
  • adds TypeScript resolution mappings for the exported paths
  • avoids BBBModal importing BBButton through the root barrel
  • updates dependency metadata so tooltip runtime packages are installed by the library

Motivation

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 lint
  • npm run build
  • npm pack
  • simulated install/build against existing BBB plugin consumers

Observed bundle-size impact in simulated consumer builds:

  • up to 91.6% raw size reduction
  • up to 82.5% gzip size reduction

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant