Skip to content
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

Deprecated package.json svelte field #371

Open
wh0am1-dev opened this issue Jan 4, 2024 · 0 comments
Open

Deprecated package.json svelte field #371

wh0am1-dev opened this issue Jan 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wh0am1-dev
Copy link

wh0am1-dev commented Jan 4, 2024

Deprecated package.json svelte field

Using the svelte field in package.json to point at .svelte source files is deprecated and you must use a svelte export condition. vite-plugin-svelte 3 still resolves it as a fallback, but in a future major release this is going to be removed and without exports condition resolving the library is going to fail.

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

Example:

// package.json
  "files": ["dist"],
  "svelte": "dist/index.js",
+ "exports": {
+   ".": {
+     "svelte": "./dist/index.js"
+   }
  }

You can also add individual exports of .svelte files in the exports map which gives users a choice to also use deep imports. See the faq about vite and prebundling why they can be useful at times.

Library authors are highly encouraged to update their packages to add the new exports condition as outlined above. Check out svelte-package which already supports it.

For backwards compatibility, you can keep the svelte field in addition to the exports condition. But make sure that both always resolve to the same files.

Repro steps

Steps to reproduce the behavior:

  1. Scaffold a project with sveltekit@latest
  2. Install p5-svelte@latest
  3. Run npm run dev

Expected behavior

There's no warning about something that's gonna be deprecated in the future... 👀

Screenshot

WindowsTerminal_nFWAYqNYoP

Desktop

  • OS: linux
  • Browser: n/a
  • Version 3.1.2
@wh0am1-dev wh0am1-dev added the bug Something isn't working label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant