Using Node.js require vs. ES6 import/export
Asked 07 September, 2021
Viewed 1.1K times
  • 61
Votes

In a project I'm collaborating on, we have two choices on which module system we can use:

  1. Importing modules using require, and exporting using module.exports and exports.foo.
  2. Importing modules using ES6 import, and exporting using ES6 export

Are there any performance benefits to using one over the other? Is there anything else that we should know if we were to use ES6 modules over Node ones?

10 Answer