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

[BUG] Static Web Assets error on build #4834

Open
mdmontesinos opened this issue Nov 15, 2024 · 1 comment
Open

[BUG] Static Web Assets error on build #4834

mdmontesinos opened this issue Nov 15, 2024 · 1 comment

Comments

@mdmontesinos
Copy link
Contributor

mdmontesinos commented Nov 15, 2024

Oqtane Info

Version - 6.0.0
Render Mode - Static
Interactivity - Server
Database - SQL Server

Describe the bug

Trying to build the Oqtane solution throws an error related to static web assets.

InvalidOperationException: Sequence contains more than one element
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsDevelopmentManifest.<ComputeManifestAssets>d__19.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsDevelopmentManifest.ComputeDevelopmentManifest(IEnumerable`1 assets, IEnumerable`1 discoveryPatterns)
   at Microsoft.AspNetCore.StaticWebAssets.Tasks.GenerateStaticWebAssetsDevelopmentManifest.Execute()

This is already tracked in the ASP.NET Core repo, but I think it's best to also log it here so people with the error can find it easily.

dotnet/aspnetcore#58859

It seems that the error happens when you have files with the same name but different extension in the wwwroot folder. As Oqtane uses this folder heavily to store most files, it's likely that you will encounter the error at some point.
I can't pinpoint right now which files are triggering it, but the candidates could be minified files (X.css and X.min.css), compressed files (X.gz) or resized images (X.jpg and X.500x500.jpg)

EDIT: As mentioned in the original issue, deleting all compressed files (like bootstrap.min.css.gz) solves the issue. Minified files and resized images do not affect it.

Expected Behavior

Steps To Reproduce

Anything else?

@sbwalker
Copy link
Member

sbwalker commented Nov 15, 2024

I am trying to find an option for disabling the new Static Web Asset capability in .NET 9... but I have not had any luck yet. The "feature" does not work well for Oqtane... and slows down the build/publish process as it creates a *.staticwebassets.endpoints.json file (which is 5 MB for Oqtane) and creates tons of *.gz, *.br files... which results in a bloated deploy package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants