Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Could not find 'BlazorExtensions' in 'window'. #10

Open
bzuidgeest opened this issue Oct 25, 2020 · 1 comment
Open

Could not find 'BlazorExtensions' in 'window'. #10

bzuidgeest opened this issue Oct 25, 2020 · 1 comment

Comments

@bzuidgeest
Copy link

I just installed the webusb extension in my first blazor project. Unfortunately it gives me this error on the console.

Similar errors in the issuelists of other blazor extensions lead me to believe that this is caused by newer versions of blazor breaking something related to static content. But nothing I found suggested worked for me.

As to recreate, I just started a new blazor app from the vs template and added the extension. I also added the code from this project its testpage.

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not find 'BlazorExtensions' in 'window'.
Error: Could not find 'BlazorExtensions' in 'window'.
at https://localhost:44355/_framework/blazor.webassembly.js:1:9130
at Array.forEach ()
at p (https://localhost:44355/_framework/blazor.webassembly.js:1:9090)
at https://localhost:44355/_framework/blazor.webassembly.js:1:9800
at new Promise ()
at Object.beginInvokeJSFromDotNet (https://localhost:44355/_framework/blazor.webassembly.js:1:9773)
at _mono_wasm_invoke_js_marshalled (https://localhost:44355/_framework/wasm/dotnet.3.2.0.js:1:171294)
at do_icall (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[6049]:0x10f8b1)
at do_icall_wrapper (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[1896]:0x50b6a)
at interp_exec_method (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[1120]:0x2588e)
Microsoft.JSInterop.JSException: Could not find 'BlazorExtensions' in 'window'.
Error: Could not find 'BlazorExtensions' in 'window'.
at https://localhost:44355/_framework/blazor.webassembly.js:1:9130
at Array.forEach ()
at p (https://localhost:44355/_framework/blazor.webassembly.js:1:9090)
at https://localhost:44355/_framework/blazor.webassembly.js:1:9800
at new Promise ()
at Object.beginInvokeJSFromDotNet (https://localhost:44355/_framework/blazor.webassembly.js:1:9773)
at _mono_wasm_invoke_js_marshalled (https://localhost:44355/_framework/wasm/dotnet.3.2.0.js:1:171294)
at do_icall (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[6049]:0x10f8b1)
at do_icall_wrapper (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[1896]:0x50b6a)
at interp_exec_method (https://localhost:44355/_framework/wasm/dotnet.wasm:wasm-function[1120]:0x2588e)
at System.Threading.Tasks.ValueTask`1[TResult].get_Result () <0x2df6dd0 + 0x00034> in :0
at Blazor.Extensions.WebUSB.USB.Initialize () [0x00041] in /home/runner/work/WebUSB/WebUSB/src/Blazor.Extensions.WebUSB/USB.cs:78
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x2db6878 + 0x000b6> in :0

@gibetcher
Copy link

the nuget package doesn't seem to be exporting everything you should. When built manually the webpack outputs a blazor.extensions.webusb.js in the /dist folder. You need to load that script somehow in your application then you can use web usb.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants