Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collocation JavaScript file breaks Hot Reload #57599

Closed
1 task done
RyouBakura opened this issue Aug 29, 2024 · 5 comments · Fixed by dotnet/sdk#43199
Closed
1 task done

Collocation JavaScript file breaks Hot Reload #57599

RyouBakura opened this issue Aug 29, 2024 · 5 comments · Fixed by dotnet/sdk#43199
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-hot-reload This issue is related to the Hot Reload feaature
Milestone

Comments

@RyouBakura
Copy link

RyouBakura commented Aug 29, 2024

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Aug 29, 2024
@MackinnonBuck MackinnonBuck self-assigned this Aug 29, 2024
@MackinnonBuck MackinnonBuck added this to the 9.0-rc2 milestone Aug 29, 2024
@MackinnonBuck
Copy link
Member

Looks like the failing target is ApplyJsModules:

The JS module file '<PROJECT_DIR>\Components\Pages\Home.razor.js' was defined but no associated razor component or view was found for it

...which gets logged from here. Need to do a bit more digging as to why it's failing.

@javiercn
Copy link
Member

@MackinnonBuck I'm pretty sure the cause of this is because there's a target that's not running for JS.

We did a specific thing for CSS hot reload, and not a general thing, so I imagine that when the file gets added, only a subset of the targets needed run and that breaks things.

@dgoldm
Copy link

dgoldm commented Sep 2, 2024

@RyouBakura thanks for pinpointing the issue. Having to restart my app after every change in css was driving me crazy. At least now I can temporarily delete the js file while working on my layouts.
I hope this gets fixed ASAP

@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. feature-hot-reload This issue is related to the Hot Reload feaature and removed investigate labels Sep 9, 2024
@MrChriZ
Copy link

MrChriZ commented Oct 18, 2024

Is this fix in .NET 9 rc2? As I'm still seeing it.

@dgoldm
Copy link

dgoldm commented Nov 11, 2024

I'm seconding @MrChriZ 's comment.
This is still broken. And very annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-hot-reload This issue is related to the Hot Reload feaature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants