Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"clean": "git checkout data/{**/,}**/logo-white.png"
},
"dependencies": {
"canvas": "^2.11.2",
"canvas": "^3.0.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This upgrade to canvas v3.0.0 is a major version bump that introduces significant breaking changes. The primary issue is that canvas v3+ is an ESM-only package, which is incompatible with your project's CommonJS module system (require()). This will break your build scripts, specifically bin/generate.js which appears to use canvas for image processing.

To resolve this, you will need to refactor the code that imports canvas to use a dynamic import(). For example:

// In your utils file, instead of:
// const { createCanvas, loadImage } = require('canvas');

// You would use:
const { createCanvas, loadImage } = await import('canvas');

Note that this will likely require making the consuming function async.

Additionally, canvas v3 introduced other breaking API changes, such as making loadImage() and canvas.toBuffer() asynchronous. You will need to carefully review the canvas v3 migration guide and update your code accordingly.

"isomorphic-fetch": "^3.0.0"
},
"devDependencies": {
Expand Down