fix(pkg): declare the top-level svelte field - #9
Merged
Conversation
Every real Svelte library declares it — bits-ui, vaul-svelte and paneforge all carry `"svelte": "./dist/index.js"`. This package did not, because the manifest is hand-written rather than generated by the library template that includes it. vite-plugin-svelte reads that field to identify a Svelte library: its `isCommonDepWithoutSvelteField` check and the dependency crawl that builds optimizeDeps config both key off it. Without the field the package is treated as an ordinary dependency, and Vite's dev-time handling of it differs from the build — which is the class of failure behind "Failed to resolve import @engineio/ui/components/ui/<name>/index.js", reported one specifier at a time as the scanner reached each. Pairs with the `default` export condition from 0.4.2: that made the subpaths resolvable at all, this makes the toolchain treat them as Svelte source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every real Svelte library carries
"svelte": "./dist/index.js"—bits-ui,vaul-svelte,paneforgeall do. This package did not, because the manifest ishand-written rather than generated by the library template that includes it.
vite-plugin-sveltereads that field to identify a Svelte library(
isCommonDepWithoutSvelteField, and the dependency crawl that buildsoptimizeDepsconfig). Without it the package is treated as an ordinarydependency and dev-time handling diverges from the build — which is the class of
failure behind:
reported one specifier at a time as Vite's scanner reached each.
Pairs with the
defaultcondition shipped in 0.4.2: that made the subpathsresolvable, this makes the toolchain treat them as Svelte source.
Verified
All 20 distinct
@engineio/uispecifiers used across engine resolve without--conditions=svelte, and both previously-failing modules(
command-dialog.svelte,Review.svelte) transform with HTTP 200 on a freshdev server.