-
Notifications
You must be signed in to change notification settings - Fork 10
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
Node canvas Path2D issue #36
Comments
Hello @gaitat Yes that should work. Can you give some more info on how and where you run this? Any other error you see? |
@gaitat have you tried to put |
It seems like this package checks for You could potentially do something like this 👇 Probably easiest to do it as a separate file, that exports out what you need const { Canvas, CanvasRenderingContext2D, createCanvas } = require('canvas')
globalThis.window = {}
globalThis.window.CanvasRenderingContext2D = CanvasRenderingContext2D
globalThis.window.document = {}
globalThis.window.document.createElement = () => createCanvas()
require('path2d-polyfill')
const Path2D = globalThis.window.Path2D
module.exports = { Canvas, CanvasRenderingContext2D, createCanvas, Path2D } @nilzona we have a pull request Automattic/node-canvas#2013 (review) that seems to duplicate most of the code in here. What do you think about us moving just the implementation of We have a organization I'm thinking that that package would just export (ping @zbjornson) |
hey @LinusU so you want a way to get hold of If that was the case, there's no need to move the code around .. right? |
The benefits of moving code around is as I see it:
I should probably have explained it a bit more in the first post sorry about that. I also don't want to step on anyones toes, and I understand that it's a large ask to be added as co-maintainers. But I also didn't want to merge the PR we had which copies the code in (I wasn't aware the code where from here until just now), or fork the repo and remove the polyfill parts, without first having a discussion 😅 Potentially having a way to access |
hey @LinusU I sent a mail to you about co-maintainer possibility. I sent it to linus@folkdatorn.se as it was your public e-mail in your github profile. |
Can this package be used with a canvas that comes from a
createCanvas()
call of the canvas npm module?When I try to use it as
I get
ReferenceError: Path2D is not defined
Thank you
The text was updated successfully, but these errors were encountered: