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
publishConfig.directory
does not get symlinked for workspace packages
#3901
Comments
pnpm creates a symlink to the publishConfig.directory, I think this maybe a hack way... as your opinion, if the directory is empty, the case will be complicated... |
Relates to #3540 |
symlinks may point to directories that don't yet exist, so it should not be a problem |
Just wanted to pitch in that we're experiencing the same problem at my company. In our monorepo setup we have several packages that produces a new |
+1 |
any updates on this? |
@zkochan thank you so much for picking this up! |
FYI currently the package version eg
"dependencies": {
"@scope/package": "workspace:*"
}, |
We might need to make this change opt-in: #5115 |
It was a breaking change, so I have reverted it in v7.8 To get this behavior, set linkDirectory to {
"publishConfig": {
"directory": "dist",
"linkDirectory": true
}
} |
publishConfig.linkDirectory should be turned off by default, which seems annoying |
pnpm version: 6.17.2
Code to reproduce the issue:
Have a workspace package that has a customised
publishConfig.directory
specified inpackage.json
:And then use the package inside another workspace package:
Expected behavior:
pnpm
creates a symlink to thepublishConfig.directory
within package-a instead of the top-level package-a directory, so that the local setup mirrors what would happen when somebody installs package-a. This is what Lerna does whenpublishConfig.directory
is set.Actual behavior:
The top-level folder for package-a is linked, thus breaking imports in projects which depend on package-a.
There is a workaround where we can use the path to the
publishConfig.directory
when we specify the dependency on package-a:However, this has a few issues:
publishConfig.directory
is effectively defined twice - if we change it in package-a's package.json, we have to change all the dependents toopublishConfig.directory
is present before we try to install dependencies in any packages which depend on package-a, otherwise an error will be thrown because the directory is missing. This means our company has ended up with a kind of weird bootstrapping step where we run install for packages with apublishConfig.directory
first, to allow theirpostinstall
build commands to run, creating the target directory in the processpnpm up
wipes out the path specifier and replaces it with the current version of the package in the workspace, egpnpm up
replacesworkspace:
protocol relative paths with version range #3902)Additional information:
node -v
prints: v14.15.1The text was updated successfully, but these errors were encountered: