BlazorApp WASM ERROR
Closed this issue · 3 comments
TypeError: Failed to resolve module specifier 'module'
at dotnet.7.0.20.hqs5bjbv9e.js:14:113131
at blazor.webassembly.js:1:39951
at async Object.start (blazor.webassembly.js:1:37432)
at async Vt (blazor.webassembly.js:1:62194)
u @ blazor.webassembly.js:1
Error: Failed to start platform. Reason: TypeError: Failed to resolve module specifier 'module'
at Vt (blazor.webassembly.js:1:62226)
u @ blazor.webassembly.js:1
Uncaught (in promise) TypeError: Failed to resolve module specifier 'module'
at dotnet.7.0.20.hqs5bjbv9e.js:14:113131
at blazor.webassembly.js:1:39951
at async Object.start (blazor.webassembly.js:1:37432)
at async Vt (blazor.webassembly.js:1:62194)
Uncaught (in promise) TypeError: Failed to resolve module specifier 'module'
at dotnet.7.0.20.hqs5bjbv9e.js:14:113131
at blazor.webassembly.js:1:39951
at async Object.start (blazor.webassembly.js:1:37432)
at async Vt (blazor.webassembly.js:1:62194)
Blazor does a check to see if it is running in a NodeJS environment. I have worked around this myself in the past... trying to find my code now. Essentially it checks for global variables like module
and process
and if they are found the startup process changes, which is what causes it to fail in NW.js. To fix it, you can rename the global variables it looks for before Blazor starts up, and change them back (if needed) after it has started.
To fix the error, rename the global variable process
before Blazor loads by adding the below code to the <head>
section of your index.html
file.
<script>
globalThis.__process = globalThis.process;
delete globalThis.process;
</script>
I tested with the template Blazor WebAssembly Standalone App
with both .Net 8.0.10 and .Net 7.0.20.
You can then put those global variables back to their original names after Blazor loads (if needed.)