I am using node-canvas, but I encountered a bug. If I try to execute the generated JavaScript, it gives me the following error:

However, if I add a require("canvas") at the top of my index.res.js, the error disappears. How can I fix this or automatically add this require("canvas") at the top? I tried using raw, but the compiler puts the replacements above it.