fix(exports): add a default condition so non-svelte resolvers work - #8
Merged
Conversation
Every subpath declared only `types` and `svelte` conditions, so anything resolving without the `svelte` condition got ERR_PACKAGE_PATH_NOT_EXPORTED: node --conditions=svelte -> resolves node -> ERR_PACKAGE_PATH_NOT_EXPORTED That is why this passed every check we ran and still broke the dev server. svelte-check and `vite build` both apply the svelte condition; Vite's dev-time import-analysis does not, so the failure surfaced only on `vite dev` and only for files inside a workspace package — reported as "Failed to resolve import @engineio/ui/components/ui/input/index.js". Adds `default` to `.`, `./components/ui/*`, `./components/ui/*/index.js`, `./components/brand` and `./components/brand/index.js`, pointing at the same file the svelte condition does, and declared LAST so the more specific conditions still win where they apply. The barrels re-export .svelte files, which only a Svelte-aware bundler can compile — but resolution and compilation are separate concerns, and refusing to resolve is what broke here. Verified: all six public subpaths now resolve with and without the condition. Self-inflicted: the exports map is hand-written rather than generated, and the `svelte`-only shape is what svelte-package emits for a Svelte-only library where every consumer is assumed to apply the condition. Vite's own dev server does not.
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.
vite devfailed with:Cause
Every subpath declared only
typesandsvelteconditions:Which is exactly why this passed every check and still broke.
svelte-checkandvite buildapply thesveltecondition; Vite's dev-time import-analysis doesnot, so it failed on
vite devonly, and only for files inside a workspacepackage.
Fix
defaultadded to.,./components/ui/*,./components/ui/*/index.js,./components/brandand./components/brand/index.js— same target as thesveltecondition, declared last so more specific conditions still win.Resolution and compilation are separate concerns: the barrels re-export
.sveltefiles that only a Svelte-aware bundler can compile, but refusing toresolve is what broke here.
Verified
All six public subpaths resolve both with and without
--conditions=svelte, andthe exact failing specifier now resolves in
engine/front.