The following problem occurs only in the designer.
I am using a blazor component which is using javascript.
When I am placing the component on a page, I get a rendering error:
Failed to fetch dynamically imported module : file:///C:/js/myScript.js
So instead using the path relative to the project, it is interpreting the
url of the script absolute to the file system.
korchev
September 14, 2026, 2:06pm
2
How does the component include the JS file? Please paste the code here.
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
{
return;
}
_module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "/js/myScript.js");
_connected = await _module.InvokeAsync<bool>("connect", _lineId, FromElementId, ToElementId, ToLeftMiddle ? "left" : "center", Straight);
}
I found the problem. For the designer it must be:
_module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./js/myScript.js");
korchev
September 14, 2026, 6:42pm
5
Hi @weismantelf ,
Thanks for the details! This is an issue in the Radzen Blazor Studio designer - it only resolves module paths that start with "./" relative to the application. We will fix it so paths starting with "/" work as well. Until then "./js/myScript.js" is the right workaround and works both in the designer and at runtime.