-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
@sveltejs/package
Allow disabling the default behavior of copying package.json
to the output directory when packaging a Svelte library
#6824
Comments
I'm here for the same issue — using Lerna (similar to Nx) to manage several packages within the same github repository. Because svelte-package moves the |
Just to add another scenario for monorepos- our SK lib requires entries in the "exports" field of the dev version of package.json that point into /src/lib/xyz. svelte-package keeps these incorrect dev specific entries when it goes to make the published version with it's own generated "exports" entries and this results in a broken published package. To work around this, we remove the "exports" field, let svelte-package do its thing and then re-insert those entries after the packaging. Here is a repro https://github.com/niktek/minimono in root, run:
If you delete the "exports" key from /packages/skeleton/package.json it will crash the newsite project. And you can see the script workarounds being employed in that same file. If you do a raw svelte-package you will see those dev "exports" be carried over into the public package folder that will then result in a broken package being published. |
Quick bump on the PR to merge a fix for this issue: |
Describe the problem
For context, I'm building a cross-framework component library so I've set up a standard package structure for each framework in my monorepo with npm workspaces.
I'm using Vite with
@sveltejs/package
to develop and build my components. However,@sveltejs/package
breaks my toolchain because it creates a copy ofpackage.json
in mydist
folder.npm workspaces picks up both the original
package.json
anddist/package.json
, causing other dependent packages to break due to the duplication.Describe the proposed solution
I rather keep my project structure and manage a single copy of
package.json
manually, so I'd like an option to disable the copy behavior.This should ideally be added to
svelte.config.js
as acopyPackageJson
option.Alternatives considered
I've tried running a script to delete
dist/package.json
manually after each build, but this frequently breaks when Nx builds multiple packages concurrently due to the race condition.Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: