Unable to build ximgproc module from contrib for opencv_js

I am trying to use the procedure at (OpenCV: Build OpenCV.js) to build opencv_js with the opencv_contrib modules, but I am not able to do so successfully.

I noticed that the imgcodecs module is disabled by default in the script (opencv/platforms/js/build_js.py at da3debda6d233af90e421e95700c63fc08b83b75 · opencv/opencv · GitHub)… And the ximgproc module depends on this and therefore is also disabled.
I tried enabling the imgcodecs module, but even after that… Although in this case cmake logs that the ximgproc module is enabled but i am not able to use any functions from it in the web.