1

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.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.