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

[Bug] React 18 is not working #340

Closed
ablackoff opened this issue Apr 16, 2022 · 3 comments
Closed

[Bug] React 18 is not working #340

ablackoff opened this issue Apr 16, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@ablackoff
Copy link

Describe the bug

When updating to React 18, the error drops:

reactDomClient.createRoot is not a function. (In 'reactDomClient.createRoot(el)', 'reactDomClient.createRoot' is undefined)

Steps to reproduce the behavior

  1. Run the react-18 example
  2. Click on "Button"

Expected behavior

Well at least there shouldn't be a mistake.

Screenshots and/or logs

image

Environment

  • OS: MacOS
  • Node.js version: v16.14.2
  • NPM version: 8.5.0
  • Browser (if applicable): chrome, safari

Additional context

I checked, the problem started with this line: https://github.com/storybookjs/builder-vite/compare/v0.1.27...v0.1.28?diff=split#diff-bd0c0785607831a0bfe079077208f5a4ec1b10ef8205c7b733c25b2e973312edR13

@ablackoff ablackoff added the bug Something isn't working label Apr 16, 2022
@ablackoff ablackoff changed the title [Bug] [Bug] React 18 not working Apr 16, 2022
@ablackoff ablackoff changed the title [Bug] React 18 not working [Bug] React 18 is not working Apr 16, 2022
@IanVS
Copy link
Member

IanVS commented Apr 17, 2022

Thanks for the report! I see what's going on, the dynamic import is missing a .default. I wonder why the storybook e2e tests passed, and why our own CI passed. It seems to me this has been broken since it was released...

@IanVS
Copy link
Member

IanVS commented Apr 17, 2022

Interesting, when building for production, the methods from the default export are hoisted up directly to the parent import(). As far as I know, that's not correct behavior per the spec, but it might be some kind of esm/cjs interop helper or something. These are the lines in storybook, fwiw: https://github.com/storybookjs/storybook/blob/0de0719db837041bf937cb6aeaa2233313c001c3/app/react/src/client/preview/render.tsx#L77-L78. I'll submit a PR to storybook to address this.

@ablackoff
Copy link
Author

I have upgraded to version 6.5.0-alpha.64, everything is working now.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants