user2953629
user2953629

Reputation: 21

Failed to fetch dynamically imported module blazor-state.lib.module.js after changing app path

I need to change default application path of my blazor application, but its not starting due to problem with Blazor-State

repro steps: I created a new blazor webassembly application and modified it as follows:

in index.html I edited:

<base href="/app/" />
<script src="/app/_framework/blazor.webassembly.js"></script>

In client project

<StaticWebAssetBasePath>app</StaticWebAssetBasePath>

and modified server Main method


 app.MapWhen(ctx => ctx.Request.Path.StartsWithSegments("/app"), first =>
            {
                first.UseBlazorFrameworkFiles("/app");
                first.UseStaticFiles();

                first.UseRouting();
                first.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllers();
                    endpoints.MapFallbackToFile("app/{*path:nonfile}", "app/index.html");


                });
            });

after that modifications, application runs correctly on new URL :https://localhost:xxxx/app

but only until I install Blazor-State package. When this package is installed application is not starting because there is problem with blazor-state.lib.module.js module.

Application tries to download the module from this URL:

https://localhost:xxxx/app/_content/Blazor-State/js/blazor-state.lib.module.js

but server return 404 - not found. Correct URL for this module is (whithout app in path)

https://localhost:xxxx/_content/Blazor-State/js/blazor-state.lib.module.js

Any ideas how to fix it?

Thanks a lot!

Maybe the solution is that Blazor-State should not use embedded resources and insert them into the page itself, but I didn't find configuration option.

Upvotes: 2

Views: 427

Answers (0)

Related Questions