pixelmatch
pixelmatch copied to clipboard
CDN script error: module not defined
Description
I'm trying to embed the script in a static HTML file, but I'm running into the following error. I think it might be due to the script being a CommonJS module - any ideas on how I could fix this without converting the entire file to ESM?
index.js:3 Uncaught ReferenceError: module is not defined
at index.js:3:1
(anonymous) @ index.js:3
HTML file:
<body>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
...
Yeah, looks like we need to convert Pixelmatch to ESM to use it on the browser properly now. Meanwhile, as a workaround, maybe you could try using Skypack CDN which does CommonJS to ESM convertion automatically: https://cdn.skypack.dev/pixelmatch
pixelmatch v6.0.0 is now a module, so this should be fixed.