Skip to content

fix(vite-config): bridge the duplicate-vite Plugin type so svelte-check passes#2151

Merged
braden-w merged 1 commit into
mainfrom
fix/vite-config-peer-variant
Jun 21, 2026
Merged

fix(vite-config): bridge the duplicate-vite Plugin type so svelte-check passes#2151
braden-w merged 1 commit into
mainfrom
fix/vite-config-peer-variant

Conversation

@braden-w

@braden-w braden-w commented Jun 21, 2026

Copy link
Copy Markdown
Member

The lockfile and root overrides already pin one vite@7.3.5, but bun materializes peer-variant copies on disk (.bun/vite@7.3.5, vite@7.3.5+4ece0cffe9718641, vite@7.3.5+682e14911fb7da75). A consuming app's @sveltejs/kit resolves the +4ece variant while @epicenter/vite-config resolves the plain one, so their Plugin / PluginOption types are nominally unrelated:

Type 'Promise<Plugin<any>[]>' is not assignable to type 'PluginOption'.
  ... Two different types with this name exist, but they are unrelated.

svelte-check hit this on packages/vite-config/src/index.ts:21 in every workspace Svelte app. Only one vite runs at runtime, so the cast bridges the array to this package's own plugin type and type resolution lines up. opensidian and vocab both go from one error to zero.

This is separate from #2140 (which pins the bun linker to isolated for layout determinism): peer-variant copies persist under both linkers, so #2140 makes the layout deterministic without collapsing this particular type clash. This is the targeted fix.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

…ck passes

The lockfile and root overrides already pin one vite@7.3.5, but bun materializes
peer-variant copies on disk (vite@7.3.5, vite@7.3.5+<hash>, ...). A consuming
app's @sveltejs/kit resolves one variant while @epicenter/vite-config resolves
another, so their Plugin / PluginOption types are nominally unrelated and
svelte-check rejects the plugins array against this package's UserConfig
("Type 'Plugin<any>[]' is not assignable to type 'PluginOption'... Two different
types with this name exist, but they are unrelated.").

Only one vite runs at runtime; bridge the array to this package's own plugin
type so type resolution lines up. This unblocks svelte-check for every workspace
Svelte app (opensidian and vocab go from one error to zero).
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

App Preview URL
Whispering https://21213c9d-whispering.epicenter.workers.dev
Landing https://5e6661f5-landing.epicenter.workers.dev

These previews update automatically with new commits to this PR.
No cleanup needed — previews are version aliases on the existing workers.


Commit 8484b94

@braden-w braden-w merged commit d9b4049 into main Jun 21, 2026
3 checks passed
@braden-w braden-w deleted the fix/vite-config-peer-variant branch June 21, 2026 21:41
Leftium pushed a commit to Leftium/epicenter that referenced this pull request Jun 23, 2026
The isolated install now resolves a single `vite` peer-variant
(`vite@7.3.5+9df36cbd11bbdf29`) that every package symlinks to: the apps,
@sveltejs/kit, @tailwindcss/vite, and @epicenter/vite-config alike. With one
physical `vite`, there is one `Plugin` type, so the plugin array already matches
`UserConfig['plugins']` and the cast added in EpicenterHQ#2151 is dead weight.

svelte-check passes with 0 errors across all nine vite-config consumers after
removing the cast from the shared helper and the three standalone configs
(matter, api/ui, skills). The bun peer-variant count is computed at install time
rather than pinned in the lockfile, so a future graph or bun-version change could
re-split `vite`; the helper comment now records that and points at the single
place to restore the cast if the clash returns.
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