From b3d927c3f330eafbff190c129b75382bdb559970 Mon Sep 17 00:00:00 2001 From: Hayden Bruin Date: Tue, 25 Aug 2026 15:13:42 +1000 Subject: [PATCH] fix(exports): add a default condition so non-svelte resolvers work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- package.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b269c1b..72078b3 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "svelte": "./dist/index.js" + "svelte": "./dist/index.js", + "default": "./dist/index.js" }, "./styles": "./dist/styles/index.css", "./styles/tokens": "./dist/styles/tokens.css", @@ -39,19 +40,23 @@ }, "./components/ui/*": { "types": "./dist/components/ui/*/index.d.ts", - "svelte": "./dist/components/ui/*/index.js" + "svelte": "./dist/components/ui/*/index.js", + "default": "./dist/components/ui/*/index.js" }, "./components/ui/*/index.js": { "types": "./dist/components/ui/*/index.d.ts", - "svelte": "./dist/components/ui/*/index.js" + "svelte": "./dist/components/ui/*/index.js", + "default": "./dist/components/ui/*/index.js" }, "./components/brand": { "types": "./dist/components/brand/index.d.ts", - "svelte": "./dist/components/brand/index.js" + "svelte": "./dist/components/brand/index.js", + "default": "./dist/components/brand/index.js" }, "./components/brand/index.js": { "types": "./dist/components/brand/index.d.ts", - "svelte": "./dist/components/brand/index.js" + "svelte": "./dist/components/brand/index.js", + "default": "./dist/components/brand/index.js" } }, "scripts": {