Skip to content

Split package into modules#161

Open
gfrn wants to merge 2 commits intomainfrom
code-splitting
Open

Split package into modules#161
gfrn wants to merge 2 commits intomainfrom
code-splitting

Conversation

@gfrn
Copy link
Copy Markdown
Collaborator

@gfrn gfrn commented Apr 10, 2026

Since not everyone might use JSON Forms and all the features sci-react-ui has, I've made this PR as a proposal to allow code splitting of modules, that way, one can import only what they need and reduce bundle size (similar to the approach material-ui has, for instance).

We also reduce the number of dependencies, as that way, one doesn't end up importing JSON-Forms or KeycloakJS if they're only using navbars.

Also, as a follow-up to #160, I've used default exports for material-icons, as that only imports the icons we're actually using.

I've also rewritten package exports to use a slightly more modern (supported since Node v12) structure, where instead of using main and module, we can assign several separate exports and entry points, which makes tree-shaking and code splitting easier.

However, this is still backwards compatible, and anyone using barrel imports from @diamondlightsource/sci-react-ui directly should not be affected, nor should anyone building this package on Node <v12 (they shouldn't, but it still works)

This requires #160 as it builds on top of those changes.

@gfrn gfrn requested a review from akademy April 10, 2026 15:30
@gfrn gfrn self-assigned this Apr 10, 2026
@gfrn gfrn changed the title Split package into navigation/theme subpackages Split package into navigation/theme modules Apr 10, 2026
@gfrn gfrn changed the title Split package into navigation/theme modules Split package into modules Apr 10, 2026
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