I have a couple of Javascript functions I need to use both on the server side and on the client side in a node application.
On the server side, I could create a module and require it. I would need to module.exports my functions. Unfortunately, I could not use that code module on the client side, because there is no such thing as require on the client side.
I don't want to maintain the (nearly) same code in two version of the files. Is there a standard/safe way to import Javascript code in a node module? I mean literally, without using require and module.exports? Or is there another solution to my issue?