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
publishDirectory appears to break monorepos #5115
Comments
This appears to be the expected behavior, see #3901 As a workaround, you may use linked dependencies if the issue is with devDependencies. So in your package.json you may actually use:
|
But looks like it is a breaking change, so I will make it opt-in for now. |
I'm running into something similar for swisspost/design-system#225. The dist folders don't exist when pnpm install is running, therefore (my guess), the link is not set up correctly in the node_modules of dependents. A fix would be creating an empty dist folder and linking that. In the building phase, the package files will appear in the folder and dependents would be able to use the packages. |
I'm running into an issue here as well. My monorepo is designed in a way that This was possible for me as packages in my monorepo reference each others TypeScript files directly, instead of using compilation/bundler targets. Before release I could pretty much do anything without having to explicitly build packages - with any code changes being picked up immediately, with every package linked to each other - now nothing works unless I bundle everything first. It's quite inconvenient and slows down development a lot to have to bundle packages just to see type system pick up changes from another package. I don't know how widely adopted this approach is - but it would be shame as dev experience is much more superior this way. Additionally - I would recommend reverting the change in |
I can revert it and add a new setting to publishConfig that will tell pnpm to symlink the package from the publish directory. Something like {
"publishConfig": {
"directory": "dist",
"linkDirectory": true
}
} |
Apologies I don't know the rationale behind this change in the first place,
but why would a monorepo want to link published directories? Isn't linking
a dev time concern?
On Sat, 30 Jul 2022 at 19:00, Zoltan Kochan ***@***.***> wrote:
I can revert it and add a new setting to publishConfig that will tell pnpm
to symlink the package from the publish directory. Something like
{
"publishConfig": {
"directory": "dist",
"linkDirectory": true
}
}
—
Reply to this email directly, view it on GitHub
<#5115 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABVORJBWU5HDDYPSYTWEG3VWVUSBANCNFSM55AZ7AEQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
…________________________________
ꜽ . antony jones . http://www.enzy.org
|
This is how |
pnpm version: 7.7.0
The addition of
publishDirectory
to the lockfile, and subsequent pointing of devDependencies topublish
directories breaks monorepos where builds are required to publish the dependencies.Often, the
publishDirectory
doesn't exist at development time.Code to reproduce the issue:
Working on a repro, but offering this as a heads-up whilst that happens.
Expected behavior:
'@beyonk/brand': link:../../components/brand
With pnpm < 7.7.0, dependencies within the lockfile point to the development files, not the published files, which might not yet have been built. They certainly aren't build during development, because it would require running (for example) the
svelte-kit package
command on every change.Package is run at build time, on CI, and may not even exist locally.
pnpm does not point dev dependencies to published directories.
Actual behavior:
'@beyonk/brand': link:../../components/brand/package
pnpm adds
publishDirectory: package
to the lockfile, and points the dependency path to thepublishDirectory
.Additional information:
node -v
prints: v16.15.0The text was updated successfully, but these errors were encountered: