-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Package command copies publishConfig.directory
into the generated package.json
#5830
Comments
Fixing this would help me out a ton. Working with Sveltekit packages in monorepos right now is annoying. |
I'm not against this suggestion, but I do wonder, however - why do you need to run SvelteKit packaging on monorepos? You may just import the path of the Svelte files to your other projects. |
@Tal500 You can just import paths, but then you'll not use the library the same way others use it when it's distributed. The monorepos I work with are usually one application and a bunch of distributed libraries owned and maintained by the app, but used by other apps as well. Then it's nice that using |
As a temporary/alternative solution to your problem, you can use path aliasing in Vite. See for example what I did there: |
@Tal500 Thanks for the example, but the alias and resolution of packages is not the problem. The problem is that the |
Describe the problem
Referencing
svelte-kit package
generated packages through the workspace protocol of pnpm doesn't work out of the box. Most monorepo tools (pnpm included) will normally just symlink the root/source directory when you use a workspace version (likeworkspace:*
). Sincesvelte-kit package
outputs a new directory structure with its ownpackage.json
file, that doesn't work out of the box. You can however use a new feature (see this issue) in pnpm that allows you to specify the directory of the package (containing a new package.json) through thepublishConfig.directory
. This works great, and solves almost all of the problems. However, the package command copies thepublishConfig.directory
setting over to the new generated package.json file. This can cause a lot of issues, since that directory does not exist.Describe the proposed solution
I suggest just removing the
publishConfig.directory
key if it exist from the generatedpackage.json
file, just like you already do for the script tag. I believe something likedelete pkg.publishConfig?.directory
close to where you delete the script key would suffice. However, it might be cases where this is not the desired behavior.Alternatives considered
It does not seem to cause immediate problems for pnpm at least, since it only looks at the
publishConfig.directory
key once for the root/source directory, and not recursively. So it might be fine to keep it as is. But to me having thepublishConfig.directory
inside the generated package.json doesn't make sense, and I can imagine several cases where it would be troublesome.Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: