Skip to content

Commit 9042265

Browse files
committed
🤖 Prevent Tailwind plugin from applying to worker builds
Use plugin apply() filter to exclude workers from Tailwind processing. This ensures workers are built with only the explicit worker.plugins.
1 parent 7f9a2e1 commit 9042265

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

vite.config.mts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ const basePlugins = [
3939
plugins: babelPlugins,
4040
},
4141
}),
42-
tailwindcss({
43-
// Explicitly configure to avoid interfering with worker builds
44-
scan: {
45-
include: ['src/**/*.{ts,tsx,js,jsx}'],
46-
exclude: ['**/*.worker.ts'],
42+
{
43+
...tailwindcss(),
44+
// Prevent Tailwind from applying to worker builds
45+
apply(config, { command }) {
46+
// Only apply to client builds, not workers
47+
return !config.build?.ssr && config.worker === undefined;
4748
},
48-
}),
49+
},
4950
];
5051

5152
export default defineConfig(({ mode }) => ({

0 commit comments

Comments
 (0)