script.js cannot be loaded when Razor component is emended in an Razor page [Blazor Server]
Hi
the Blazor.Print works well in an pure Blazor App. I am adding Blazor to an existing MVC / Rzor pages Project. When calling PrintingService.Print in an Razor component and t5his razor component is embedder in an razor Page the script.js could not be doinloaded to the server.
-
On a pure Blazor project the ImportModule() function try to download the script.js file from _content/Append.Blazor.Printing/scripts.js
-
if the Razor component is embedded the ImportModule() function try to download the script.js file from XXXXRazorPage_content/Append.Blazor.Printing/scripts.js
// this could help
internal async ValueTask ImportModule()
{
// module = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Append.Blazor.Printing/scripts.js");
module = await jsRuntime.InvokeAsync<IJSObjectReference>("import", $"{this.navigationManager.BaseUri}_content/Append.Blazor.Printing/scripts.js");
}
@wolfgangschneider Interesting, is there some general guidance on this in the Blazor Docs? Because this might cause problems elsewehere. If you like PR's are welcome, don't forget to create a MVC example so we can test it later on.
Hi,
Is this error related to this problem?

Im not in a pure Blazor App indeed.
Thanks