ligershark/WebOptimizer.Sass

.Net 6 doesnt work without Startup-Program structure

EmilAlipiev opened this issue · 4 comments

I have upgraded my Blazor Wasm application from .net 5 to .net 6. and nothing works. Code below just works fine on .net 5. But once migrated to .net 6 using only Program.cs, not bunding at all. I tried also with fresh new project from VS template and result it the same.
however if i am on .net 6 and if i continue using startup file, it works fine. What could be the deal here? I dont see any exception thrown.

  builder.Services.AddWebOptimizer(pipeline =>
    {
        pipeline.CompileScssFiles();
        pipeline.AddCssBundle("/css/app.css", "/sass/app.scss");
    });

here is a simple repro

BlazorAppWebOptimzer.zip

@EmilAlipiev I think I know what the problem is. You are using Blazor WASM and I'm not quite sure that WebOptimizer is compatible with it. It works with Blazor Server. I checked and don't even see any examples with Blazor Wasm, not even on articles online like this one

Your index.html page is not processed by the server like a regular .cshtml razor page is. Maybe the author can give some feedback on this.

thats right it is with WASM and used to work well with .net 5 although not documented. Stopped working with .Net 6 unfortunately :(

While debugging, seems that ExecuteAsync() method is not called or at least debugger not stopping there although it stops in Compiler() constructor method. I believe the issue might be on the main library WebOptimizer and not in WebOptimizer.Sass. Try to create an issue there and mention this.

Would like to see a way to use this with Blazor WebAssembly. Why should Web Optimizer be only for the server?