joshnuss / svelte-persisted-store

A Svelte store that persists to localStorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v0.9.3 breaks imports with SvelteKit

khromov opened this issue · comments

Just saw the new version tagged and updated, but it does not seem to work with SvelteKit. So if you have this issue, you can stay on 0.9.2 for now.

Here is a SvelteLab reproduction:
https://www.sveltelab.dev/k303hv6xldifpue

 The plugin "vite:dep-scan" was triggered by this import

    src/lib/stores/user.ts:3:26:
      3 │ import { persisted } from 'svelte-persisted-store';
        ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~


✘ [ERROR] Failed to resolve entry for package "svelte-persisted-store". The package may have incorrect main/module/exports specified in its package.json. [plugin vite:dep-scan]

I can confirm this change breaks Vite's build process (So even just Vite + Svelte)

I can confirm the same thing happens for me.
It's caused by an attempt to fix this issue: #258
It seems simply adding type: "module" is not enough.

I don't know a lot about packaging but I can see that module is set to dist/index.mjs here which doesn't seem right as the generated dist folder doesn't contain such a file.

Is it possible it never caused an issue before because the package wasn't a module, and now that it is it's trying to load that file which doesn't exist?

commented

what's needed is adding exports field to package.json

https://publint.dev/svelte-persisted-store@0.9.3

@joshnuss I suggest you add a publint as part of your CI / prepublish checks: npx publint

Thanks for reporting!

Sorry about that.

It is now fixed in ddfe9d4.

Please update to v0.9.4