IJSObjectReference module import path error #47430
Labels
area-blazor
Includes: Blazor, Razor Components
feature-blazor-wasm
This issue is related to and / or impacts Blazor WebAssembly
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
Status: Resolved
Is there an existing issue for this?
Describe the bug
the Blazor Server app runs in two diffrent enviroments (dev and production). I have a component which must use some JS - no library
module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./scripts/bankeinzugrazor.js");
make wring path in production (url site/pp/)
https://...site/pp/ppscripts/bankeinzugrazor.js
JavaScript can not be load. 404 as path should be pp/scripts
Other ./ path issues are solved by
<base href="~/pp" />
or in more generic way by
also tried to use app.UsePathBase, but docu says obsolete in 6?
Expected Behavior
korrekt path to js
Steps To Reproduce
Visual Studio Blazor Server projekt
place Js in wwwroot scripts
load Module from .razor OnAfterRenderAsync
Exceptions (if any)
No response
.NET Version
7.0.202 /6
Anything else?
No response
The text was updated successfully, but these errors were encountered: