From 8484b94af215286948a42218342f38eb6cec0ad0 Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Sun, 21 Jun 2026 12:48:15 -0700 Subject: [PATCH] fix(vite-config): bridge the duplicate-vite Plugin type so svelte-check 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+, ...). 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[]' 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). --- packages/vite-config/src/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/vite-config/src/index.ts b/packages/vite-config/src/index.ts index c24f582e62..d60bede350 100644 --- a/packages/vite-config/src/index.ts +++ b/packages/vite-config/src/index.ts @@ -18,7 +18,12 @@ import { searchForWorkspaceRoot, type UserConfig } from 'vite'; */ export function workspaceAppViteConfig(app: { port: number }): UserConfig { return { - plugins: [sveltekit(), tailwindcss()], + // A consuming app's `@sveltejs/kit` and this package can resolve different + // bun peer-variant copies of the same `vite` version (`vite@7.3.5` vs + // `vite@7.3.5+`), whose `Plugin` types are then nominally unrelated, + // so `svelte-check` rejects the array against this package's `UserConfig`. + // One vite runs at runtime; bridge the array to this package's plugin type. + plugins: [sveltekit(), tailwindcss()] as UserConfig['plugins'], resolve: { dedupe: ['yjs'], },