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

pnpm workspace with mixed remix versions fails #6691

Closed
1 task done
joshmedeski opened this issue Jun 26, 2023 · 2 comments
Closed
1 task done

pnpm workspace with mixed remix versions fails #6691

joshmedeski opened this issue Jun 26, 2023 · 2 comments

Comments

@joshmedeski
Copy link

What version of Remix are you using?

1.17.1

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. Setup a remix app in a pnpm workspace
  2. Include a separate app with a React v17 app
  3. Set pnpm overwrites for the react version
{
  "pnpm": {
    "overrides": {
      "@remix-run/dev>@types/react": "^18.0.35",
      "@remix-run/dev>@types/react-dom": "^18.0.11",
      "@remix-run/dev>react": "^18.0.35",
      "@remix-run/dev>react-dom": "^18.0.11",
      "@remix-run/serve>@types/react": "^18.0.35",
      "@remix-run/serve>@types/react-dom": "^18.0.11",
      "@remix-run/serve>react": "^18.0.35",
      "@remix-run/serve>react-dom": "^18.0.11",
      "react-dom@>=17>@types/react-dom": "^17.0.2",
      "react-dom@>=18>@types/react-dom": "^18.0.11",
      "react@>=17>@types/react": "^17.0.2",
      "react@>=18>@types/react": "^18.0.35"
    }
  }
}

Here are my .npmrc settings

engine-strict=false
fetch-timeout=100000
auto-install-peers=true
legacy-peer-deps=true
node-linker=hoisted
strict-peer-dependencies=false
prefer-symlinked-executables=false

Expected Behavior

The pnpm overwrites allow me to use remix with React v18 while a legacy React v17 app lives in the same pnpm workspace.

Actual Behavior

When I run the pnpm run dev command on the remix app I get the following error:

✘ [ERROR] Could not resolve "react-dom/client"

  ../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@remix-run/dev/dist/config/defaults/entry.dev.ts:9:9:
    9 │   import("react-dom/client");
      ╵          ~~~~~~~~~~~~~~~~~~

You can mark the path "react-dom/client" as external to exclude it from the bundle, which will remove this error. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time. 

My best guess is the dev entry file is attempting to use React v17 and can't resolve the react-dom/client module. If I open that file in my editor, the type definition resolves to React v18 so it's unclear how to debug any future.

p.s. I've had it occasionally work successfully but am not able to recreate it on my team member's Window's machine (I'm on macOS) and if I reinstall my node_modules it begins to not work again.

@brophdawg11
Copy link
Contributor

I think this is a dup of #6710 - could you confirm if the nightly release (v0.0.0-nightly-0657c16-20230630) fixes it for you and close this out if so?

@joshmedeski
Copy link
Author

You're right @brophdawg11, I just tested the nightly release and it worked!

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

2 participants