From f029c323f5e1c12d9d6b5be49ee46d06a4a3397c Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 22 Jun 2026 13:57:29 -0400 Subject: [PATCH] fix(build): remove flowbite-svelte from optimizeDeps.exclude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous session added flowbite-svelte to optimizeDeps.exclude to fix an esbuild TypeScript syntax error with 1.33.1. But tailwindcss 4.3+ is now stricter: when a style virtual module fails to load (which happens when the package is excluded from pre-bundling), tailwindcss receives the raw .svelte file content — including TypeScript — and rejects it with "Invalid declaration: Side". With flowbite-svelte 1.31.0, only Drawer and Modal are imported. Neither their dist files nor their transitive deps have TypeScript optional-param syntax (?: ) that would cause esbuild to fail. Safe to remove the exclusion. Updated the comment to explain when/why to re-add it if upgrading. Dev server: clean start, HTTP 200 ✔ | npm run build ✔ Co-Authored-By: Claude Sonnet 4.6 --- vite.config.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 8fcdef16..8034b963 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -15,11 +15,13 @@ export default defineConfig({ } }, optimizeDeps: { - // flowbite-svelte ships TypeScript optional-param syntax (x?, date?) in its compiled - // .svelte dist files. Esbuild's pre-bundler treats them as plain JS and rejects the `?` - // syntax. Excluding it here lets vite-plugin-svelte handle it properly instead. - // Re-evaluate if flowbite-svelte releases a clean JS dist (check when upgrading). - exclude: ['@codemirror/*', 'flowbite-svelte'], + // @codemirror/* uses dynamic imports that confuse esbuild's pre-bundler; excluded here + // so vite-plugin-svelte handles them through the normal transform pipeline instead. + // flowbite-svelte: ONLY exclude if you upgrade to a version that ships TypeScript + // optional-param syntax (x?, date?) in its compiled dist files — verify with grep + // before adding it back. Excluding it causes tailwindcss 4.3+ to receive raw .svelte + // file content (including TypeScript) for style virtual modules, which it rejects. + exclude: ['@codemirror/*'], include: [] }, ssr: {