Could not find 'BlazorExtensions.Canvas2d.add' ('BlazorExtensions' was undefined)
I followed the steps in the ReadMe to create a 2D canvas component. However, when I run my application on localhost using IIS, I get the following error in the console:
Could not find 'BlazorExtensions.Canvas2d.add' ('BlazorExtensions' was undefined)
I've added usings everywhere I'm supposed to, and Googling this issue turned up just about nothing, so I'm not sure what else to try. Any help would be appreciated.
Sorry to be late to the party. I ran into this same issue. The fix was to add this to my index.html. Hope it helps.
<script src="_content/Blazor.Extensions.Canvas/blazor.extensions.canvas.js"></script>
Even it you do add the script to a client's project's index.html it only seems to work properly if the server project also has the Blazor.Extensions.Canvas installed.
If not, drawing will result in faults until the browser is refreshed.
Fixed it for me, thanks !
~~Hey I'm also getting this error. I already have~~
~~<script src="_content/Blazor.Extensions.Canvas/blazor.extensions.canvas.js"></script>~~
~~In my index.html though. And added following to my _Imports.razor~~
~~@using Blazor.Extensions @using Blazor.Extensions.Canvas @using Blazor.Extensions.Canvas.Canvas2D~~
~~The only thing I'm doing in the canvas is using DrawImageAsync in order to add an image.~~
I retried thing about 100 times and rebuilding and it didn't work. I'd given up but after few days came back and it was just working. So clearly something was just stale.