You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
webpack/rspack: virtual modules fail with ENOENT when the build context goes through a symlink #640
When the context of a webpack or rspack build goes through a symlink, every virtual module fails to build with ENOENT. This happens to any project under macOS's tmpdir (/var is a link to /private/var), and to a project in a linked folder (or a Windows junction) on any OS.
The virtual module prefix is built on compiler.options.context as given, so the virtual module is written under the link. Both resolvers follow symlinks (resolve.symlinks is on by default), so the module is then read from the real path, where nothing was written.
I have a PR ready with a fix and tests: it builds the prefix on the real path of the context in both adapters.
Additional context
The suite already works around this: virtual-cache.test.ts and escaped-path.test.ts run realpathSync on their temp dirs because webpack resolves to /private/var.
rspack fails the same way, on <real>/node_modules/.virtual/....
Logs
ERROR in ../real/_virtual_%00virtual-msg
Module build failed (from ../node_modules/unplugin/dist/webpack/loaders/load.mjs):
Error: ENOENT: no such file or directory, open '<repro>/real/_virtual_%00virtual-msg'
Activity