Schum123 / svelte-loading-spinners

A collection of loading spinner components for SvelteJs
https://schum123.github.io/svelte-loading-spinners/
MIT License
511 stars 35 forks source link

Using the svelte field in package.json to point at .svelte source files is deprecated #52

Closed afif-nass closed 5 months ago

afif-nass commented 8 months ago

Getting this warning for svelte-loading-spinners@0.3.4:

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

Easy fix

mellanslag-de commented 7 months ago

I get this warning as well. But I checked the package.json. and it was actually already fixed. The doc page you linked also mentions to be ably to mention every single .svelte file individually. and this is what this repo does.

My local package.json of this dependency looks like this:

{
 // ...
 "exports": {
    "./package.json": "./package.json",
    "./ArrowDown.svelte": "./ArrowDown.svelte",
    "./ArrowUp.svelte": "./ArrowUp.svelte",
    "./BarLoader.svelte": "./BarLoader.svelte",
    "./Chasing.svelte": "./Chasing.svelte",
    "./Circle.svelte": "./Circle.svelte",
    "./Circle2.svelte": "./Circle2.svelte",
    "./Circle3.svelte": "./Circle3.svelte",
    "./Clock.svelte": "./Clock.svelte",
    "./Diamonds.svelte": "./Diamonds.svelte",
    "./DoubleBounce.svelte": "./DoubleBounce.svelte",
    "./Firework.svelte": "./Firework.svelte",
    "./GoogleSpin.svelte": "./GoogleSpin.svelte",
    ".": "./index.js",
    "./Jellyfish.svelte": "./Jellyfish.svelte",
    "./Jumper.svelte": "./Jumper.svelte",
    "./Moon.svelte": "./Moon.svelte",
    "./Plane.svelte": "./Plane.svelte",
    "./Puff.svelte": "./Puff.svelte",
    "./Pulse.svelte": "./Pulse.svelte",
    "./Rainbow.svelte": "./Rainbow.svelte",
    "./RingLoader.svelte": "./RingLoader.svelte",
    "./ScaleOut.svelte": "./ScaleOut.svelte",
    "./Shadow.svelte": "./Shadow.svelte",
    "./SpinLine.svelte": "./SpinLine.svelte",
    "./Square.svelte": "./Square.svelte",
    "./Stretch.svelte": "./Stretch.svelte",
    "./SyncLoader.svelte": "./SyncLoader.svelte",
    "./types/spinner.type": "./types/spinner.type.js",
    "./utils": "./utils.js",
    "./Wave.svelte": "./Wave.svelte"
  },
  "svelte": "./index.js"
}

(seems to somehow get genereated, couldnt find this file in this repo. Only in my projects node_modules/svelte-loading-spinners/package.json file.)

I had another dependency with this error as well, and the startup warning message disappeared after adding the new version. But for some reason, here it doesnt disappear. Only when I remove the top-level "svelte"-key, its fine. I guess the script to detect when to show the warning is faulty, and doesnt detect this multi-file export variant.

So in conclusion: This package seems fine and up-to-date. The warning shouldnt be displayed, but doesnt seem to be the fault of this package.

mellanslag-de commented 7 months ago

So in my opinion this issue can get closed

neil-ennis commented 7 months ago

The warning resolves when I change this line: ".": "./index.js", To this:

    ".": {
        "svelte": "./index.js"
    },

This seems to be the format suggested in the "missing exports condition" of this article.

jill64 commented 6 months ago

I guess that this exports field was auto-generated by an older svelte-package version. Fundamentally, we need to upgrade the toolchain, but we will try to prepare a PR to suppress the warning by monkey patch.

jill64 commented 5 months ago

I emailed the author to merge the PRs, but received no response.
I published the forked repository to npm as a workaround.

https://npmjs.com/package/@jill64/svelte-loading-spinners https://github.com/jill64/svelte-loading-spinners

npm i @jill64/svelte-loading-spinners

package.json

{
  "dependencies": {
-    "svetle-loading-spinners": "0.3.4"
+    "@jill64/svelte-loading-spinners": "0.3.6"
  }
}
Schum123 commented 5 months ago

Hey @jill64 I will check the PR and merge. Thank you!

Schum123 commented 5 months ago

0.3.5 should be published now!