The goal is to make the generated JavaScript to look like require(".../something.server.js") or import ... from ".../something.server.js". This lets Remix know that the code shouldn’t be included in the frontend bundle.
BTW, this should not be necessary most of the time, as far as I understand. Only when tree-shaking gets confused and you need to force it to not include the code.
This tends to happen when you try to use module X from a file named X.Something.res.
But in any case, what @tsnobip suggests will create a .server.js file with the right content, but you’ll still need to import this file in the generated JavaScript, which is the tricky part.
oh yeah that’s right, I guess you should call it something different than Auth, maybe just create a file AuthServer.res and auth.server.res will import AuthServer.
If your rescript code has to import this file in the generated JS, then I guess you have to go with @rpominov’s solution which is safer than a pure %raw. But really, JS frameworks should really stop creating semantics out of nowhere. This leads to such poor flexibility and hidden magic.