Skip to content

Warning about legacy package.json format in Svelte package #437

@benmccann

Description

@benmccann

Description

The following warning is being produced

4:57:38 PM [vite-plugin-svelte] WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.

@egjs/[email protected]

Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.

This can be addressed by setting exports. The following fields can probably all be removed: svelte, main, module, es2015. Svelte packages should not be compiled with the Svelte compiler. However, they should be preprocessed to convert any TypeScript code to JavaScript code. This can be difficult to do manually. Svelte provide a svelte-package command to assist with this: https://kit.svelte.dev/docs/packaging. However, the .ts file here is very simple, so one solution would probably be to just rename it .js and remove the build step.

Changing the packaging in this way will be required to continue working with future versions of Svelte, but is a breaking change, so it should be done before a 4.0 release.

Steps to check or reproduce

Use in a Svelte project. E.g. checkout https://github.com/immich-app/immich, cd web, npm install, npm run build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions