I've written ES module which imports other modules and exports some stuff. Now I want to use the same module in Node. (share the same file)
Is there any universal way how to deal with differences e.g. "import" vs "require" and "export" vs "exports"? I want solution without browserify or webpack, just some hack to make it work in node and in browser too.
I can make the "export" part, I don't know if there is any hack to make the "import/require" part.
import/exportwith node: stackoverflow.com/a/39436580/5734311 and here's how to use it in a browser: stackoverflow.com/questions/48211891/…--experimental-modulesflag in node 12 LTS.