Main idea here is that since Js module is shadowed there is no way to get access to original Js module. But you can get submodules like Js_exn and use it one way or another.
This is working well but has a limitation: in case of ReScriptJs, Promise has been overwritten by @ryyppy/rescript-promise and this is causing trouble as generated code by rescript-relay is looking for the original one.
I have to not open ReScriptJs via bcc-flags and keep local open
I never use -open, I made my own mini stdlib file that I manually open at the top of every file. This “mini stdlib” uses a combination of module X = Belt.X and include to bring together everything I use regularly.
When done this way, the original Js reference can be stored before open ReScriptJs.
Is it possible to override an open like Belt? I like to just use belt but include my own modules, and creating a file named Belt in my own repo doesn’t seem to work.
It’s impossible, so I’ve written a tool to solve the problem: https://github.com/DZakh/rescript-stdlib-cli.
It misses some features for gradual adoption, but the main functionality works properly. We use it in production without a problem.