-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add svelte exports field to package json when running package command #1959
Comments
From Rich: |
I just tested this out and it seems Vite is able to deal with a Svelte package packaged through the On an unrelated note: I noticed that Vite was not able to deal with exports besides the default export, so deep exports from |
Seems like there's a case where an error occurs: #1856 . So this thing should likely be added somehow. |
Without pkg.svelte being defined, the library has to be added to SvelteKit projects as a regular dependency (i.e not a devDependency) otherwise they will get the kit/packages/kit/src/core/utils.js Lines 85 to 100 in 69b92ec
and I guess regular dependencies automatically get included under Would it make sense to also check pkg.exports for any entrypoints with a |
That might get fixed by vitejs/vite#4450 |
I might've reduced my lifespan when I first encountered this and trying to figure out what's wrong back in the early days before version "exports": {
"./foo": {
"import": "./foo/index.js"
}
} This should solve our deep exports problem, but I hope those more familiar with Vite could take a look and possibly understand what's going on, enough to solve it on their side. P.S. It's been months since then so I don't know if something has changed with this behavior, almost certain it's still the same |
Several heuristics in Kit/vite-plugin-svelte to tell Vite to mark Svelte packages rely on the "svelte" property. Vite/Rollup/Webpack plugin can all deal with it. Fixes #1959
Several heuristics in Kit/vite-plugin-svelte to tell Vite to mark Svelte packages rely on the "svelte" property. Vite/Rollup/Webpack plugin can all deal with it. Fixes #1959 Co-authored-by: Bjorn Lu <[email protected]>
Describe the problem
SvelteKit currently has a heuristic in place which tells Vite which packages are Svelte packages (for noExternal stuff) by looking up the
package.json
content and seeing if there's asvelte
property.The
svelte-kit package
command does not currently set this field.Describe the proposed solution
Use the same logic that is used for the
main
entry to produce asvelte
entry.Alternatives considered
A workaround for now is for users to specify this field in their
package.json
themselves as it's copied over as of lately.Importance
would make my life easier
Additional Information
The
svelte
key is likely more of a historical thing at this point, and deserves some more thought regarding the new developments, but for now the quick fix is to just add this fieldThe text was updated successfully, but these errors were encountered: