Skip to content
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

Use production build of react, react-dom in the manager #29166

Open
Tracked by #29038
JReinhold opened this issue Sep 19, 2024 · 0 comments
Open
Tracked by #29038

Use production build of react, react-dom in the manager #29166

JReinhold opened this issue Sep 19, 2024 · 0 comments
Assignees

Comments

@JReinhold
Copy link
Contributor

JReinhold commented Sep 19, 2024

manager in @storybook/core bundles in React and React DOM, so it can globalize it and ensure that any code in the manager (including addons') uses a single instance of React.

However if you look at the metafile analysis for the manager entry point in @storybook/core, you'll see that it actually bundles in the development builds of those two packages instead of the production builds.

image

Not only are these 10x bigger, they are also slower overall on the browser. We should figure out why our bundling tool uses the wrong build here.
The downside of fixing this is that you'll get a slightly worse dev experience when developing for the manager (eg. building an addon), because you'll get worse errors. I'm not sure yet if we can do something in addon-kit to avoid this.

I don't see anything in the bundle scripts or code that indicates that this is explicitly on purpose.

Note the same thing seems to happen with react-router and react-router-dom in the CJS outputs of the router entry point, but not in the ESM one.

@JReinhold JReinhold changed the title Use production build of React in the manager Use production build of react, react-dom in the manager, react-router, react-router-dom in the router Sep 19, 2024
@JReinhold JReinhold changed the title Use production build of react, react-dom in the manager, react-router, react-router-dom in the router Use production build of react, react-dom in the manager Sep 19, 2024
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

No branches or pull requests

2 participants