Please advise on the development of new projects.
This problem was also considered when studying react. First, we can understand the mechanism of these two modules. ReferencesHere
Points to consider:
At present, Commonjs is supported by nodejs (browser environment needs module loader), while es6 needs babeljs to implement. This means that if automatic compilation is to be implemented online (our company does not install node_modules online), node_modules such as babel may need to be submitted to the code warehouse, which is about 45M.
Also consider whether your react component library is based on es6 or Commonjs. If your business uses the Commonjs specification and your components use es6, this cannot be unified.
Considering the familiarity of the team with es6, it is related to the code quality and maintenance cost.
That’s all for now.