website like a paytm what is more suitable common JS or ESM

35 views Asked by At

I'm thinking of making a website that works like Paytm and they have similar features what are we going to use which one is more suitable, a common JS or ES module

and with the reasons what is the main reason and why we have to use either it's common js or es modules in backend server i hope you will give me a good answer with the good reason

1

There are 1 answers

0
jfriend00 On

If I were starting a new project now, I would use ESM modules for my code because that is clearly the future of the language and of nodejs.

The only reason I would consider CommonJS modules was if I had a large amount of code that was already in the CommonJS style and/or I was going to be using some important third party modules that were only CommonJS.

But, CommonJS and ESM are much more interoperable now than they originally were so even if I still need some CommonJS code in my project from outside modules, I'd still write all my own code as ESM modules.