Manual OpenCV.js build not working in Node

I want to build my own copy of opencv.js to be able to include image processing function that are not available in the readily available opencv.js.

I followed the build instructions for the 4.7 version using the Docker and emscripten v2.0.10.
The build is successful and generates a seemingly valid custom_opencv.js file.

However, when I try to use this custom version of openCv in one of the documented exemples it does not work properly.

// From the doc
Module = {
  onRuntimeInitialized() {
    console.log("This is properly called after init");
    console.log(cv.getBuildInformation()); // This does not log anything
cv = require('./opencv.js')

When trying to access an openCv method such as cv.matFromImageData(imageSrc.bitmap);, I get a runtime error TypeError: cv.matFromImageData is not a function.

For comparison, the available opencv.js works perfectly fine.

Any opinion or idea on how to debug this would be appreciated.