-
-
Couldn't load subscription status.
- Fork 199
Description
In webpack 4, when SymlinkPlugin identified that a requested path indeed contained a symlink, it would invoke hook relative with the canonical path.
enhanced-resolve/lib/ResolverFactory.js
Line 329 in 2dfe18a
| if (symlinks) plugins.push(new SymlinkPlugin("file", "relative")); |
However, in Webpack 5, this behavior was changed to:
enhanced-resolve/lib/ResolverFactory.js
Lines 589 to 590 in f08fe3f
| if (symlinks) | |
| plugins.push(new SymlinkPlugin("existing-file", "existing-file")); |
This modification was done in the process of adding support for Yarn PnP, though it seems that this might have been unintentional. See notably sokra's comment on this regard here. It should also be noted that this specific change does not appear in the final PR.
This undocumented change of behavior affects some external plugins that relied on early hooks to be invoked after symlink resolution, notably Gatsby's theme shadowing (see related Gastby issue).
My first impression is that this specific change should be reverted back and I will soon submit a PR in this direction.
On the other side, it means that any plugin that relies on the former behavior would not support Yarn PnP; there might also be a non negligeable performance cost to redo a part of the resolution pipeline after symlink resolution. Consequently, somes could argue that restoring the former behavior is not desirable. If this is indeed the official position, however, then I suggest that this should be clearly mentioned in Webpack release notes.