Skip to content

@sveltejs/package Allow disabling the default behavior of copying package.json to the output directory when packaging a Svelte library #6824

@bryanmylee

Description

@bryanmylee

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 of package.json in my dist folder.

npm workspaces picks up both the original package.json and dist/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 a copyPackageJson 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions