Catch errors when invoking applyPath2DToCanvasRenderingContext
This way we allow the rest of the packages to be loaded successfully, such that e.g. the Node.js unit-tests work correctly. Note that this occurred after updating the `node-canvas` package to version `3.0.0-rc2`, however it's not immediately clear to me if it's a problem there or in the `path2d` package; see also nilzona/path2d-polyfill/issues/84.
This commit is contained in:
parent
6ae13fac9b
commit
54e00b0104
@ -83,7 +83,11 @@ if (isNodeJS) {
|
||||
applyPath2DToCanvasRenderingContext &&
|
||||
Path2D
|
||||
) {
|
||||
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
|
||||
try {
|
||||
applyPath2DToCanvasRenderingContext(CanvasRenderingContext2D);
|
||||
} catch (ex) {
|
||||
warn(`applyPath2DToCanvasRenderingContext: "${ex}".`);
|
||||
}
|
||||
globalThis.Path2D = Path2D;
|
||||
} else {
|
||||
warn("Cannot polyfill `Path2D`, rendering may be broken.");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user