-
Notifications
You must be signed in to change notification settings - Fork 64
Better tree-shakeability, React 19, typed JSX-components #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset statusBased on the included changeset, the following releases will be published as a result of this PR:
Note: If unpublished changesets where merged to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades React to v19 and introduces tree-shakeable, typed JSX components that improve developer ergonomics. Key changes include bumping to React 19, exporting direct JSX component wrappers from the Core library, and providing a side-effect free way to use components via pure imports.
Reviewed Changes
Copilot reviewed 957 out of 959 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
apps/react-lib-dev/src/design/blocks/sidebar.tsx | Introduces the Sidebar component with routing and layout changes. |
apps/react-lib-dev/src/design/blocks/header.tsx | Implements the Header component with a responsive menu toggle. |
apps/react-lib-dev/src/config/routes.tsx | Defines the new route configuration with nested subRoutes. |
apps/react-lib-dev/src/components/green-core-form.tsx | Updates the form example to use new JSX wrappers and a dynamic field reflection. |
apps/react-lib-dev/src/app/app.tsx | Refactors the App component to integrate the new Header/Sidebar layout and dynamic route rendering. |
apps/docs/utils/import/components.tsx | Switches from dynamic imports to static re-exports from the new Core react package. |
apps/docs/app/layout.tsx | Wraps the layout in the new theme component to enforce the design version. |
.changeset/* | Updates documenting the React 19 upgrade and treeshaking improvements. |
Files not reviewed (2)
- apps/docs/tsconfig.json: Language not supported
- apps/react-lib-dev/project.json: Language not supported
Comments suppressed due to low confidence (1)
apps/react-lib-dev/src/components/green-core-form.tsx:231
- The component 'CoreFlex' is used without an explicit import; please ensure that it is properly imported to avoid runtime errors.
<CoreFlex align-items="center" gap="m">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, tremendous amount of work here very excited to upgrade docs to latest version 👌
This PR bumps React to version 19 for the mono repo. This means that tests and builds of the React library will run against v19 going forward.
There are also a few other changes included, aimed to improve developer experience:
"Batteries included" for React:
Since React 19 natively supports custom elements, we can export typed JSX components from the Core library instead of relying on Lits custom element wrapper. This means that it will no longer be necessary to create local wrappers for React. Instead components can just be imported from
@sebgroup/green-core/react
:Move towards tree-shakeable components:
This changes the way components are defined in the custom elements registry. Previously it was only possible to import components with the define step was a mandatory side-effect. This meant that bundles could not remove any Green Core components, even if they were not used or referenced.
In this PR, an alternative, side-effect free, way of importing components has been added. Each component now has a file called
[name].component.ts
which holds the actual implementation, but does not define the custom element. Each component class now also has a static method calleddefine()
which can be used to define the element. The old[name].ts
module will still call the define step, so existing code should remain unaffected.All the side-effect free components are then bulk exported from
@sebgroup/green-core/pure
so that imports can be grouped.Here is how to use the new side-effect free imports:
For screnarios where bundle size is irrelevant, all components (including icons) can be imported from
@sebgroup/green-core/everything
. Use with caution, as this will inflate your bundle size with ~600kb: