canvas icon indicating copy to clipboard operation
canvas copied to clipboard

Example usage with fabric.js or Konva.

Open seanghay opened this issue 2 years ago • 4 comments

Both libs depend on node-canvas how can we use @napi-rs/canvas as a replacement for node-canvas?

seanghay avatar Dec 27 '22 03:12 seanghay

I think this should be in discussions tab 😐

seanghay avatar Dec 27 '22 03:12 seanghay

I need to pass the integration tests in fabric / Konva first, I don't have time to do this right now

Brooooooklyn avatar Feb 02 '23 03:02 Brooooooklyn

Is it possible to make @napi-rs/canvas to have the same API as node-canvas? If that possible I would like to create an adapter just for that and then alias that in package.json.

seanghay avatar Feb 04 '23 08:02 seanghay

I'm trying to swap in @n-api/canvas with webpack

new NormalModuleReplacementPlugin(/(?<!@n-api.)canvas/, "@napi-rs/canvas"),

But am not best with regex and so it's recursing and giving this error

ERROR in ./node_modules/@napi-rs/canvas/index.js Module build failed: Error: ENOENT: no such file or directory, open '/fm4/node_modules/@napi-rs/canvas/@napi-rs/canvas'

-- I like @seanghay 's idea to match the API !!

(I wish it's weren't too late to change the module name...)

ajoslin103 avatar Feb 28 '23 14:02 ajoslin103