user22867147
user22867147

Reputation: 1

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

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

Upvotes: 0

Views: 30

Answers (1)

jfriend00
jfriend00

Reputation: 708146

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.

Upvotes: 0

Related Questions