fix(docker): polyfill DOMMatrix/ImageData/Path2D for pdfjs-dist in linux/amd64 container via NODE_OPTIONS --require
This commit is contained in:
11
teressa-copeland-homes/scripts/polyfill-dom.cjs
Normal file
11
teressa-copeland-homes/scripts/polyfill-dom.cjs
Normal file
@@ -0,0 +1,11 @@
|
||||
// Polyfills for browser globals required by pdfjs-dist in Node.js.
|
||||
// Required via NODE_OPTIONS=--require so it runs before any module evaluation.
|
||||
if (typeof globalThis.DOMMatrix === 'undefined') {
|
||||
globalThis.DOMMatrix = class DOMMatrix { constructor() { return this; } };
|
||||
}
|
||||
if (typeof globalThis.ImageData === 'undefined') {
|
||||
globalThis.ImageData = class ImageData { constructor() { return this; } };
|
||||
}
|
||||
if (typeof globalThis.Path2D === 'undefined') {
|
||||
globalThis.Path2D = class Path2D { constructor() { return this; } };
|
||||
}
|
||||
Reference in New Issue
Block a user