ESM: Named Exports and Imports

Learn about named exports and imports and how to export functionality from the modules.

We'll cover the following

Named exports and imports

ESM allows us to export functionality from a module through the export keyword.

Note: ESM uses the singular word export as opposed to the plural (exports and module.exports) used by CommonJS.

In an ES module, everything is private by default, and only exported entities are publicly accessible from other modules.

The export keyword can be used in front of the entities that we want to make available to the module users. Let’s see an example:

Get hands-on with 1400+ tech skills courses.