Skip to content

Collocation JavaScript file breaks Hot Reload #57599

@RyouBakura

Description

@RyouBakura

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The mere presence of a collocated Javascript file, e.g. "Home.razor.js" breaks Hot Reload functionality for .css files. However C# Hot Reload is not affected.

Expected Behavior

CSS Hot Reload should work.

Steps To Reproduce

  1. Clone the repo project. It's a fresh Blazor Web App.
Click to expand. It was created with the following settings: devenv_U7PjEbL993
  1. Run the project and change the color property in "Home.razor.css" to see that Hot Reload is working!
  2. Stop debugging.
  3. Add a new file called "Home.razor.js"
  4. Run the project again and change the color property in "Home.razor.css" once more.
  5. You should now see this dialog telling you it went wrong:
devenv_6hPiTE3fNi

Exceptions (if any)

18:19 18.29 HotReloadDestroyer: Scoped CSS file changed: Z:\Dotnet\HotReloadDestroyer\Components\Pages\Home.razor.css
18:19 18.35 HotReloadDestroyer: Building scoped CSS files in project HotReloadDestroyer
18:19 18.59 HotReloadDestroyer: [Error] Building scoped CSS files failed for project HotReloadDestroyer
18:19 18.59 Invalid changes were found. Please refer to the Error List window to fix those issues.
18:19 27.95 HotReloadDestroyer (Web server): Hot reload session complete

.NET Version

9.0.100-preview.7.24407.12

Anything else?

I've encountered this problem in both .NET 8 and .NET 9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-hot-reloadThis issue is related to the Hot Reload feaature

    Type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions