-
Notifications
You must be signed in to change notification settings - Fork 792
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
Mock canvas element when prerendering [getContext is not a function] #1706
Comments
Hi @renrizzolo Would you be up to submit a PR? It's probably the file where MockCanvasElement should be, and where createElement() switch is |
你可以声明变量的类型,示例: |
Stencil version:
I'm submitting a:
[ ] bug report
[X] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
When using the
--prerender
flag, the prerender will fail when usinggetContext()
on a canvas element. canvas is not mocked in hydrate/prerender/mock-doc.Expected behavior:
Prerender doesn't fail when calling
getContext()
on a canvas element.Steps to reproduce:
Related code:
Other information:
I'm not actually trying to use canvas - I would wrap the above example with
Build.isBrowser
if that were the case.I'm importing the library lottie-web, which has some functions that use
getContext()
.One solution would be to add this simple mock to the switch in the
createElement
function in dist/hydrate/index.js (not sure what the true source of that function is).Although I'm wondering if there's a simple way to avoid this issue when prerendering, e.g through rollup or some other config?
The text was updated successfully, but these errors were encountered: