excubo-ag / WebCompiler

Apache License 2.0
148 stars 29 forks source link

Blazor 8 WebAssembly hot-reload not working #82

Closed michaelvolz closed 9 months ago

michaelvolz commented 9 months ago

I installed WebCompiler as local tool, because I need it to work via GitHub Actions. I put this code into my project file:

  <Target Name="ToolRestore" BeforeTargets="PreBuildEvent">
    <Exec Command="dotnet tool update excubo.webcompiler" StandardOutputImportance="high" />
  </Target>

  <Target Name="CompileStaticAssets" AfterTargets="AfterBuild">
    <Exec Command="dotnet tool run webcompiler -r wwwroot -c webcompilerconfiguration.json" StandardOutputImportance="high" />
  </Target>

  <ItemGroup>
    <Watch Include="**\*.scss;**\*.sass" />
  </ItemGroup>

When I build the project everything works fine.

When using dotnet watch the .scss file is not re-compiled. I tried it via launchsettings.json and directly from the terminal.

Any tips or suggestions would be appreciated.

stefanloerwald commented 9 months ago

There's nothing in your project file that tells the build system that the webcompiler command depends on the scss files. Without that, the system will notice (because of the added watch paths) that the files were changed, but it will not see any commands that need executing.

michaelvolz commented 9 months ago

This makes this tool quite useless. Thank you.

stefanloerwald commented 9 months ago

Again, this is not a problem with this tool, but with the insufficient code you added to the project file.