Skip to content

After 7.1 Vite is not hot reloading pages when changing php files with tailwindcss #20743

Closed

Description

@furkantaskin

Describe the bug

I am using customized vite configuration with vanilla PHP backend. Before 7.1 update hmr was working fine for both TS, PHP and CSS files. After 7.1 page reload has stopped working. Whenever I update PHP files, it triggers
"hmr update /src/style.css?direct" thus it injects CSS but not reloading the page. I need to manually refresh the page for it. On CLI, it shows hmr update but not triggering page reload.

Reproduction

https://github.com/furkantaskin/rolldown-vite-hmr-problem

Steps to reproduce

Running npm run dev and updating any content of PHP file is enough to reproduce the issue.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
    Memory: 2.17 GB / 15.73 GB
  Binaries:
    Node: 22.19.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.5.2 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.21 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (140.0.3485.54)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    rolldown-vite: ^7.1.8 => 7.1.8

Project Direcotry: E:\www (using IIS and Windows Virtual Disk for E drive)

Used Package Manager

bun

Logs

Current Vite Log
  vite:deps (client) Hash is consistent. Skipping. Use --force to override. +0ms

  ROLLDOWN-VITE v7.1.8  ready in 463 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
  vite:resolve 1.38ms /@vite/client -> E:/www/vite_test/node_modules/rolldown-vite/dist/client/client.mjs +0ms
  vite:resolve 3.86ms /src/style.css?direct -> E:/www/vite_test/src/style.css?direct +1ms
  vite:resolve 2.45ms /src/main.ts -> E:/www/vite_test/src/main.ts +1ms
  vite:load 3.01ms [fs] /@vite/client +0ms
  vite:resolve 5.05ms @vite/env -> E:/www/vite_test/node_modules/rolldown-vite/dist/client/env.mjs +26ms
  vite:import-analysis 13.91ms [1 imports rewritten] node_modules/rolldown-vite/dist/client/client.mjs +0ms
  vite:transform 26.54ms /@vite/client +0ms
  vite:time 62.45ms /@vite/client +0ms
  vite:load 64.75ms [fs] /src/style.css?direct +63ms
  vite:resolve 0.08ms tailwindcss -> null +50ms
  vite:load 90.31ms [fs] /src/main.ts +25ms
  vite:load 173.29ms [fs] /node_modules/rolldown-vite/dist/client/env.mjs +112ms
  vite:import-analysis [skipped] src/style.css?direct +175ms
  vite:transform 138.97ms /src/style.css?direct +175ms
  vite:time 215.43ms /src/style.css +148ms
  vite:import-analysis 0.08ms [no imports] node_modules/rolldown-vite/dist/client/env.mjs +7ms
  vite:transform 9.42ms /node_modules/rolldown-vite/dist/client/env.mjs +7ms
  vite:time 120.52ms /node_modules/rolldown-vite/dist/client/env.mjs +7ms
  vite:import-analysis 0.20ms [no imports] src/main.ts +3ms
  vite:transform 123.49ms /src/main.ts +2ms
  vite:time 219.71ms /src/main.ts +3ms
  vite:hmr [file change] index.php +0ms
14:46:07 [vite] (client) hmr update /src/style.css?direct
  vite:hmr (ssr) [no modules matched] index.php +44ms
  vite:load 1.79ms [fs] /src/style.css?direct +4s
  vite:import-analysis [skipped] src/style.css?direct +4s
  vite:transform 29.40ms /src/style.css?direct +4s
  vite:time 33.21ms /src/style.css +4s

Validations

Activity

  1. added theissue type on Sep 9, 2025
  2. hi-ogawa commented on Sep 10, 2025

    @hi-ogawa
    Contributor

    Does it also reproduce on latest vite?

  3. added theissue type on Sep 10, 2025
  4. added
    p3-minor-bug
    regression
    on Sep 10, 2025
  5. hi-ogawa commented on Sep 10, 2025

    @hi-ogawa
    Contributor

    I have moved the issue to main vite repo. Here is a simplified reproduction https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vite-20743-non-html-tailwind-full-reload The change is likely due to #20391.

    You can workaround the issue by adding a following plugin:

    plugins: [
    	{
    		name: 'reload-non-vite-code',
    		hotUpdate(ctx) {
    			if (ctx.file.endsWith(".php")) {
    				ctx.server.environments.client.hot.send({
    					type: 'full-reload',
    				})
    			}
    		},
    	}
    ]
  6. changed the title [-]After 7.1 Vite is not hot reloading pages on save[/-] [+]After 7.1 Vite is not hot reloading pages when changing php files with tailwindcss[/+] on Sep 10, 2025
  7. sapphi-red commented on Sep 10, 2025

    @sapphi-red
    Member

    This is expected because Vite doesn't know about *.php and shouldn't treat *.php specially.

    The plugin above or vite-plugin-full-reload should work.

  8. furkantaskin commented on Sep 11, 2025

    @furkantaskin
    Author

    This is expected because Vite doesn't know about *.php and shouldn't treat *.php specially.

    The plugin above or vite-plugin-full-reload should work.

    Before 7.1 update on both Vite and Rolldown Vite, PHP was working perfectly fine. I'm not bundling the project. Using Vite just to build assets using Tailwind and TypeScript. After 7.1 update Vite started to ignore hot reload but still triggers hmr operation. I'm not expecting Vite to support PHP cuz I know it's not in Vite's nature. But as I said at least Vite was detecting changes on PHP files and triggers full reload.

  9. hi-ogawa commented on Sep 11, 2025

    @hi-ogawa
    Contributor

    The behavior you are seeing is fairly specific to tailwind and there was an undesired behavior related to this, which is fixed by #20391. For your use case, we recommend triggering full-reload via custom plugin as it would work in general.

  10. locked and limited conversation to collaborators on Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugregression

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions