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 <18 does not work due to react-reconciler dependency #1062

Open
1 task
mattrunyon opened this issue Jun 23, 2024 · 8 comments
Open
1 task

React <18 does not work due to react-reconciler dependency #1062

mattrunyon opened this issue Jun 23, 2024 · 8 comments

Comments

@mattrunyon
Copy link

What version of million are you using?

1.0.0-rc.26

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

What browser are you using?

Chrome

Describe the Bug

Tried installing @million/lint with a Vite project running React 17.0.2. Can't start anything with errors about trying to import react-dom/client.

react-reconciler has a peer dep for react ^18.3.1. This causes it to be installed by npm in node_modules/@million/lint/node_modules/react. The code to detect the React version looks like it checks via import { version } from 'react' which will resolve to the react version installed by the react-reconciler peer dependency, not the version in the workspace.

Not sure if this is an npm issue only, but the default behavior of npm 7+ is to install peer dependencies that are unmet. So it's expected behavior from npm based on the packages.

What's the expected result?

@million/lint working with React 16.8 - 17 when using npm

Link to Minimal Reproducible Example

https://stackblitz.com/edit/vitejs-vite-xfzbac?file=package.json

Participation

  • I am willing to submit a pull request for this issue.
Copy link

Thanks for opening this issue! A maintainer will review it soon.

@ogi-joo
Copy link

ogi-joo commented Jun 30, 2024

Any update on this?

@mountEvarus
Copy link

@ogi-joo if this helps, reverting to 1.0.0-rc.18 seems to solve the issue for me for the time being

@bingoYB
Copy link

bingoYB commented Jul 1, 2024

@ogi-joo if this helps, reverting to 1.0.0-rc.18 seems to solve the issue for me for the time being

When I switched to 1.0.0-rc.18, a new issue occurred 😢
image

@ogi-joo
Copy link

ogi-joo commented Jul 1, 2024

@mountEvarus @bingoYB
Well I don't use million, but another package which also has problem with react-reconciler.

I use React 19 RC and it doesn't work. Only when I downgrade. I think this is similar problem to mine.

So there has to be some workaround or we wait for react-reconciler patch? Idk

@NisargIO
Copy link
Collaborator

NisargIO commented Oct 1, 2024

Hey guys! @mattrunyon @bingoYB @mountEvarus @ogi-joo

We just shipped a new, stable version! Hopefully, this will fix the issues you guys are having. Can you try running the setup script npx million@latest. Once it's done, please restart your VSCode/Cursor. Let me know if that works for you!

@MiltonAkash
Copy link

image

@Rumperuu
Copy link

Rumperuu commented Nov 4, 2024

Still failing with Webpack 5.77.0 and React 17.0.2:

ERROR in ./node_modules/@million/lint/dist/runtime-dev/index.mjs 6441:13-39
Module not found: Error: Can't resolve 'react-dom/client' in '[REDACTED]/node_modules/@million/lint/dist/runtime-dev'
resolve 'react-dom/client' in '[REDACTED]/node_modules/@million/lint/dist/runtime-dev'
  Parsed request is a module
  using description file: [REDACTED]/node_modules/@million/lint/package.json (relative path: ./dist/runtime-dev)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      [REDACTED]/ts/node_modules/@million/lint/dist/runtime-dev/node_modules doesn't exist or is not a directory
      [REDACTED]/ts/node_modules/@million/lint/dist/node_modules doesn't exist or is not a directory
      looking for modules in [REDACTED]/node_modules/@million/lint/node_modules
        [REDACTED]/node_modules/@million/lint/node_modules/react-dom doesn't exist
      [REDACTED]/node_modules/@million/node_modules doesn't exist or is not a directory
      [REDACTED]/node_modules/node_modules doesn't exist or is not a directory
      looking for modules in [REDACTED]/node_modules
        existing directory [REDACTED]/node_modules/react-dom
          using description file: [REDACTED]/node_modules/react-dom/package.json (relative path: .)
            using description file: [REDACTED]/node_modules/react-dom/package.json (relative path: ./client)
              [../REDACTED]/node_modules/react-dom/client doesn't exist
      [../../REDACTED]/node_modules doesn't exist or is not a directory
      [../../../REDACTED]/node_modules doesn't exist or is not a directory
      [../../../../REDACTED]s/node_modules doesn't exist or is not a directory
      [../../../../../REDACTED]/node_modules doesn't exist or is not a directory
      [../../../../../../REDACTED]/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
 @ ./[REDACTED].tsx 5:0-59 6:0-61 7:0-83 8:0-55 42:15-19 43:12-16 44:11-15 67:15-19 68:12-16 69:11-15 158:15-19 159:11-15 168:13-17 170:136-140 184:17-24 184:28-34 184:161-179 197:18-25 197:29-35 197:162-180 210:18-25 210:29-35 210:162-180

webpack 5.79.0 compiled with 1 error in 17709 ms
No errors found.

This workaround makes it work though: manually amend react-dom/client to react-dom in node_modules/@million/lint/dist/runtime-dev/index.mjs (line 6442 for me)

You can also use patch-package to make the change persist across upgrades.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants