rgossiaux / svelte-headlessui

Unofficial Svelte port of the Headless UI component library
https://svelte-headlessui.goss.io
MIT License
1.78k stars 96 forks source link

warning when using sveltekit v2: The following packages have a svelte field in their package.json but no exports condition for svelte. #170

Open thenbe opened 9 months ago

thenbe commented 9 months ago

Describe the bug Using this package with sveltekit v2 shows a warning during vite dev or vite build:

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

@rgossiaux/svelte-headlessui@2.0.0

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

Library version @rgossiaux/svelte-headlessui: 2.0.0

msdrigg commented 9 months ago

Seeing this in my build as well after upgrading. Looks easily fixible by

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

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