-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Yarn PnP Virtual Workspaces Filepaths Not Properly Transpiled #199
Comments
Do you have any idea how it could be solved? |
Aug 8, 2022 update: things seem to be working fine now with Interestingly, I'm experiencing a possibly similar issue after making some minor/patch dependency updates (Next.js 10.1.3 -> 10.2.0), maybe something in Next.js itself changed? Running When I try to build:
I get this error:
Interesting, it's not failing in dev mode. Things work fine with this (because it's not using pnpify?):
Note that for me it's failing at exporting a type - maybe my issue is different? Seems like some TypeScript webpack loader isn't getting configured correctly? Will try some workaround and update this if I discover anything. Versions
|
I just came here to say that we have this very setup and I think our modules ( I remember that we've seen some strange "virtual" paths in the transpiled output but I believe it was when we used the node-modules linker and hoisting decided to work differently than we expected. With PnP, I don't remember having issues. But as you describe it, @jpulec, it sounds like there should be an issue so I'll be watching this 😄. |
is there any update on this? I would happily peer program/onboard to the project to find a resolution! Getting the error as long as I enable I think this issue seems to be related. |
I was a little silent in the past months due to loads of work on my plate, but I'm on holidays so I may have some time to investigate :) Out of curiosity, can you try what I mentioned here? #75 (comment) |
Yes, I am getting the same error as if I would if I was using the npm module directly
I would say it makes sense, since having a look at the codebase, it seems that Since yarn PNP would install deps under
Thoughts? |
Any news? I managed to reproduce the issue myself https://github.com/smulikHakipod/next-yarn-transpile-error . Need to run this: And watch transpilation failed. I dont think "virtual" modules are supposed to be problematic on their own, its fine for Yarn to create a virtual path for a module. I put some prints in the code in order to check the comparison next-transpile-modules make and it seems to be something like this:
You can see that test-bb-virtual-eb81ca8611 is not the same as test-bb-virtual-6b51d9b693, I am guessing because some the compile process spawn child processes and each child process get a different module id (just a guess). Yet I have no idea how to solve it. I hope someone has a clue. Thanks! |
Quick update: with |
Are you sure you are talking about the same issue? I attached above a repo that reproduces the issue, with the latest Next and Next Transpile module. Still reproduces. Can you double-check me, please? |
Are you trying to transpile a local package or an npm package?
I'm trying to transpile sibling workspace packages.
Describe the bug
When using Yarn 2 PnP in a monorepo with yarn workspaces, sometimes a workspace may get resolved to a virtual package. Yarn uses virtual packages mainly to handle peerDependencies properly.
The result of this is that calling
require.resolve('@myworkspace/common')
may return a virtual filesystem path, (i.e..yarn/$$virtual/@myworkspace-common
) instead of the actual on disk location of the package.This becomes a problem because the generated matcher for
next-transpile-modules
checks the resolved paths against the real file paths that webpack passes in theinclude
condition of the rule thatnext-transpile-modules
adds to the webpack config.The result is that the file path does not match and as a result is not transpiled.
To Reproduce
package-a
referencepackage-b
using theworkspace:
protocol.react
topackage-b
)package-b
will now be virtual and not properly transpiled.Expected behavior
The virtual filepaths should behave the same way as real filepaths, and should be transpiled.
Setup
next-transpile-modules
version: 6.4.0yarn
version: 2.4.0If I can find a little time, I'll try to put together a full reproduction repo.
The text was updated successfully, but these errors were encountered: