-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Vite: cannot resolve asset path in turborepo monorepo #7927
Comments
Could you make a reproduction repo? I'm using |
Oh interesting, would you be able to provide the configs you have for your project? I'll be able to make the reproduction repo in a bit. |
While making the reproduction repo, I think I found the source of the bug. I explicitly created the Remix Vite repo inside of a Turborepo mono repository. I believe what Vite was complaining about was that the "react" dependency was in the node_modules of the monorepo folder rather than the node_modules of the Remix Vite project folder instead. Copying the Remix Vite project folder outside of the Turborepo monorepo and re-installing dependencies causes the code to work again. |
Created a reproduction here: https://github.com/lithdew/remix-vite-monorepo % npm run dev
> dev
> vite dev
VITE v4.5.0 ready in 597 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
⚠️ Remix support for Vite is unstable
and not recommended for production
9:53:10 PM [vite] Internal server error: Cannot resolve asset path "/Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/@remix-run/dev/dist/config/defaults/entry.server.node.tsx" outside of root directory "/Users/dew/remix-vite-monorepo/remix-vite-monorepo/apps/web".
at resolveFileUrl (/Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/@remix-run/dev/dist/vite/plugin.js:74:11)
at getServerEntry (/Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/@remix-run/dev/dist/vite/plugin.js:197:51)
at async Context.load (/Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/@remix-run/dev/dist/vite/plugin.js:434:20)
at async Object.load (file:///Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44323:32)
at async loadAndTransform (file:///Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:54954:24)
at async instantiateModule (file:///Users/dew/remix-vite-monorepo/remix-vite-monorepo/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55951:10) |
Thanks for the reproduction. |
This worked, many thanks. |
What version of Remix are you using?
2.2.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
git clone https://github.com/lithdew/remix-vite-monorepo.git
npm install
npm run dev
Expected Behavior
It works.
Actual Behavior
The text was updated successfully, but these errors were encountered: