dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.59k stars 10.06k forks source link

Reduce error level of `blazor.web.js` does not exist errors #57149

Open captainsafia opened 4 months ago

captainsafia commented 4 months ago

When building a fresh copy of the repo, I get errors about the Debug builds of the blazor.web.js file not being found because I have not run npm ci && npm run build on the repo. The message indicates that the check-in copy of the file will be used as a fallback.

/Users/captainsafia/git/aspnetcore/57112/src/Components/Endpoints/src/Microsoft.AspNetCore.Components.Endpoints.csproj(72,5): error : '../../Web.JS/dist/Debug/blazor.web.js' does not exist. Falling back to checked-in copy.

Because of our warn-as-errors configuration, this warning manifests as an error that breaks the build.

Can we add an exemption for this error to avoid erroneously warning on projects that don't need debug builds of blazor.web.js?

cc: @javiercn @wtgodbe since I'm not sure what the current status of the compiled JS scripts is

javiercn commented 3 months ago

@captainsafia yes, let me see what we can do.

@wtgodbe has been changing stuff here. I'm not sure if this is new behavior or if we introduced a change on behavior that now triggers this.

MackinnonBuck commented 3 months ago

@wtgodbe, would you be able to take a look at this?

wtgodbe commented 3 months ago

@captainsafia does the same thing repro when building the release/8.0 branch?

captainsafia commented 3 months ago

@captainsafia does the same thing repro when building the release/8.0 branch?

It doesn't appear to repro on release/8.0 for me...

javiercn commented 1 month ago

@captainsafia how are you reproducing this?

Were you missing node, npm on the machine or were you passing /p:NoBuildNodeJs=true explictily?

captainsafia commented 1 month ago

@javiercn Sorry it took me a while to get this notification!

I do have Node and NPM on my PATH:

$ node --version
v20.14.0
$ npm --version
10.7.0

I get the error when executing a plain old .build.sh on the src/Mvc directory for example:

$ cd src\Mvc
$ ./build.sh
...
Microsoft.AspNetCore.Components.Server failed with 16 error(s) (1.4s)
    /Users/captainsafia/git/aspnetcore/iresult-bug/src/Components/Server/src/Microsoft.AspNetCore.Components.Server.csproj(110,5): error : '../../Web.JS/dist/Debug/blazor.server.js' does not exist. Falling back to checked-in copy.
...