-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Using pnpm with remix package #154
Comments
The following works…
And as far as I can see…
|
One helpful step would be to configure |
Thanks. I did not have to do that. The default demo app just works. |
I did 😅 I got a typescript error trying to do Though you could argue that it should be 🤷 |
I couldn't get the site to start in dev mode when it was a package inside of a workspace though due to this error:
Versions: |
same here using pnpm workspace |
Hey @matthewlynch , did @tylerbrostrom's steps help you bypass the "No matching export" error? I'm assuming it's related to PNPM hoisting. I'm working in a RushJS monorepo which uses PNPM under the hood with a shared PNPM cache, and running into the same issue. I wonder if there's a missing |
@matthewlynch Okay, I think I figured it out. PNPM is very picky/explicit about dependencies, which helps to avoid "phantom dependencies". The But While NPM and Yarn will happily resolve the See more on phantom dependencies in the RushJS docs, although this issue isn't limited to Rush and affects all PNPM monorepo/workspace setups. Temporary resolution for me was to add a PNPM module resolution hook in a module.exports = {
hooks: {
readPackage: (packageJson, context) => {
if (packageJson.name === '@remix-run/react') {
packageJson.dependencies = {
...packageJson.dependencies,
history: '^5.1.0',
};
}
return packageJson;
},
},
}; Long-term fix would be to update the |
Also: tools like depcheck can be used to see if there are imported modules that aren't listed in your deps. This is also important for Yarn PnP projects |
@eldarshamukhamedov your workaround solved my problem, thank you! |
mark. |
I have the same error when using Remix with Yarn workspaces. I'm solving error after the error but this one I have no way of solving. It's basically makes Remix not usable in monorepo... |
Is there any progress? |
@0x219 have you tried upgrading to the latest version of Remix? I am running 1.3.4 in a Rush monorepo using PNPM and no longer need the workaround described above. I am not using PNPM workspaces, however, so your mileage may vary. I also ended up switching away from |
ok thanks, i get it. |
The fix for this moving forward will be to import modules directly from the correct scoped package rather than the |
The
remix
package is a special one because its exports change based on what other packages you have installed. However, instead of resolving packages at runtime, pnpm uses hard links on the file system at install time.What this means for us is that when you install
remix
with pnpm, it is linked into anode_modules/.pnpm/remix@version
directory. Inside that, there is anothernode_modules
directory that contains theremix
package and is supposed to contain links to its dependencies as well. But they aren't there sinceremix
doesn't explicitly list its dependencies. This means that whenremix
imports something, it has to go look for it innode_modules
.I'm not sure exactly why this is a problem for pnpm, but I believe it ends up causing two different copies of Remix to be loaded in the browser so we don't get the same context objects and
<Outlet>
rendersnull
. Still need to look into this further.The text was updated successfully, but these errors were encountered: