You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a requirement where building a websocket server for my remix app (some pages use websocket for chat server like functionality).
This lives under the server.js. while building out the functionality I needed to import some code from within my app directory. As this by default typescript and used esm modules. I was unable to import it through node directly.
My work around was to expose the module functions through the global-data.js as it was then compiled for server via typescript and put in a build folder. I was then able to include it from the build folder to get access to my ts module.
Making the server be compiled with typescript would make this include a bit more seemless - however I know this would add complexity in starting as ATM if the build director is empty the server.js can't start (which happens on first run of the app if bulid/cache is cleared).
The text was updated successfully, but these errors were encountered:
I had a requirement where building a websocket server for my remix app (some pages use websocket for chat server like functionality).
This lives under the server.js. while building out the functionality I needed to import some code from within my
app
directory. As this by default typescript and used esm modules. I was unable to import it through node directly.My work around was to expose the module functions through the global-data.js as it was then compiled for server via typescript and put in a build folder. I was then able to include it from the build folder to get access to my ts module.
Making the server be compiled with typescript would make this include a bit more seemless - however I know this would add complexity in starting as ATM if the build director is empty the server.js can't start (which happens on first run of the app if bulid/cache is cleared).
The text was updated successfully, but these errors were encountered: