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

react-jsx example no longer works when updating to React 18 #928

Open
mor10 opened this issue Jan 27, 2023 · 3 comments
Open

react-jsx example no longer works when updating to React 18 #928

mor10 opened this issue Jan 27, 2023 · 3 comments

Comments

@mor10
Copy link

mor10 commented Jan 27, 2023

Update the dependencies to React v18 and the react-jsx example no longer works. When the process runs, the generated page is blank and console returns the following error:

Uncaught SyntaxError: The requested module './../node_modules/react/index.js' does not provide an export named 'default' (at App.jsx:1:8)

Not sure if this issue originates with esbuild or modernweb-dev but it is not documented and is reproducible with any project running React v18.

@angrycat9000
Copy link

Ran into a similar problem with the react-tsx example as well.

Had a minimal test case using https://github.com/modernweb-dev/example-projects/tree/master/react-tsx

  1. Change the react and react dom dependencies in package.json to ^18.0.0.
  2. Run npm install
  3. Run npm run test
  4. Get the following error:

🚧 Browser logs:
SyntaxError: The requested module './../node_modules/react/index.js' does not provide an export named 'default'

@MaxdAyala
Copy link

I found a CDN that provides an ES Build of react 18.2.

https://esm.sh/

By replacing the imports in every file the tests and demo ran in the react-tsx example.

import React from "https://esm.sh/[email protected]";
import ReactDOM from "https://esm.sh/[email protected]/";

Useful as a demo, but maybe won't give Typescript support when importing via the cdn.

@kimani400
Copy link

"Hi everyone, I noticed this issue and would like to help. Could someone guide me on where to start looking or which part of the codebase might be affected? Also, are there any known workarounds that might help narrow down the problem?"

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

4 participants