Skip to content

twcss very slow in dev, >30s to load page after hmr update/ssr reload #17581

@gschwim

Description

@gschwim

What version of Tailwind CSS are you using?

4.1.3

What build tool (or framework if it abstracts the build tool) are you using?

sveltekit 2.20.4, vite 6.2.4

What version of Node.js are you using?

22.14.0

What browser are you using?

chrome, brave

What operating system are you using?

MacOS

Reproduction repo is here

Describe your issue

Base sveltekit install, added tailwindcss, imported to src/app.css. Once the import is added any change to content, css, or otherwise takes >30 seconds to refersh in the browser. I found [this issue](https://github.com/tailwindlabs/tailwindcss/issues/17522#issue-2968155486} that describes what I'm seeing very well, but the times are much longer, and I'm running the version of twcss that should have the fix.

I ran pnpm run dev with env variable DEBUG=1 and received the following output (annotated):

➜ ➜ pnpm run dev --host

> [email protected] dev /Users/demo/tmp/sk-demo
> vite dev --host


  VITE v6.2.4  ready in 2077 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: http://172.16.1.194:5173/
  ➜  Network: http://172.16.3.5:5173/
  ➜  press h + enter to show help

[27945.47ms] [@tailwindcss/vite] Generate CSS (serve)
[  198.84ms]   ↳ Setup compiler
[    2.35ms]   ↳ Setup scanner
[12870.16ms]   ↳ Scan for candidates
[  886.94ms]   ↳ Build CSS


[25024.72ms] [@tailwindcss/vite] Generate CSS (serve)
[   48.78ms]   ↳ Setup compiler
[    0.09ms]   ↳ Setup scanner
[10152.08ms]   ↳ Scan for candidates
[  802.87ms]   ↳ Build CSS

end cold start, making change to +page.svelte and saving:

[14450.78ms] [@tailwindcss/vite] Generate CSS (serve)
[ 7107.51ms]   ↳ Scan for candidates
[   38.39ms]   ↳ Build CSS

9:24:33 PM [vite] (client) hmr update /src/routes/+page.svelte, /src/app.css
9:24:33 PM [vite] (ssr) page reload src/routes/+page.svelte

[14511.12ms] [@tailwindcss/vite] Generate CSS (serve)
[ 7648.28ms]   ↳ Scan for candidates
[   29.07ms]   ↳ Build CSS

9:24:48 PM [vite] (client) hmr update /src/routes/+page.svelte, /src/app.css
9:24:48 PM [vite] (ssr) page reload src/routes/+page.svelte

now a change to +layout.svelte

9:25:25 PM [vite] (client) hmr update /src/routes/+layout.svelte, /src/app.css
9:25:25 PM [vite] (ssr) page reload src/routes/+layout.svelte

[13850.72ms] [@tailwindcss/vite] Generate CSS (serve)
[ 6885.26ms]   ↳ Scan for candidates
[   76.62ms]   ↳ Build CSS


[14184.31ms] [@tailwindcss/vite] Generate CSS (serve)
[ 7385.91ms]   ↳ Scan for candidates
[   24.50ms]   ↳ Build CSS

So on average, very minor changes to the files above cause a >40 second time for processing before the page reloads. This also extends to app.css changes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions