Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Could not find 'BlazorExtensions.Canvas2d.add' ('BlazorExtensions' was undefined) #112

Open
DerekR15 opened this issue Jul 24, 2021 · 4 comments

Comments

@DerekR15
Copy link

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.

@pdavis68
Copy link

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>

@wvdvegt
Copy link

wvdvegt commented Jan 4, 2023

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.

@MowedMeadow
Copy link

<script src="_content/Blazor.Extensions.Canvas/blazor.extensions.canvas.js"></script>

Fixed it for me, thanks !

@mwsaari
Copy link

mwsaari commented Jun 11, 2023

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.

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

No branches or pull requests

5 participants