Skip to content

fix(pkg): declare the top-level svelte field - #9

Merged
HaydenBruin merged 1 commit into
mainfrom
fix/svelte-field
Aug 25, 2026
Merged

fix(pkg): declare the top-level svelte field#9
HaydenBruin merged 1 commit into
mainfrom
fix/svelte-field

Conversation

@HaydenBruin

Copy link
Copy Markdown
Contributor

Every real Svelte library carries "svelte": "./dist/index.js"bits-ui,
vaul-svelte, paneforge all do. 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
(isCommonDepWithoutSvelteField, and the dependency crawl that builds
optimizeDeps config). Without it the package is treated as an ordinary
dependency and dev-time handling diverges from the build — which is the class of
failure behind:

Failed to resolve import "@engineio/ui/components/ui/dialog/index.js"

reported one specifier at a time as Vite's scanner reached each.

Pairs with the default condition shipped in 0.4.2: that made the subpaths
resolvable, this makes the toolchain treat them as Svelte source.

Verified

All 20 distinct @engineio/ui specifiers used across engine resolve without
--conditions=svelte, and both previously-failing modules
(command-dialog.svelte, Review.svelte) transform with HTTP 200 on a fresh
dev server.

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.
@HaydenBruin
HaydenBruin merged commit 27f268d into main Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant