ES Modules (ESM) in Electron
Introduction
The ECMAScript module (ESM) format is the standard way of loading JavaScript packages.
Chromium and Node.js have their own implementations of the ESM specification, and Electron chooses which module loader to use depending on the context.
This document serves to outline the limitations of ESM in Electron and the differences between ESM in Electron and ESM in Node.js and Chromium.
info
This feature was added in electron@28.0.0
.
Summary: ESM support matrix
This table gives a general overview of where ESM is supported and which ESM loader is used.
Process | ESM Loader | ESM Loader in Preload | Applicable Requirements |
---|---|---|---|
Général | Node.js | N/A | |
Renderer (Sandboxed) | Chromium | Unsupported | |
Renderer (Unsandboxed & Context Isolated) | Chromium | Node.js | |
Renderer (Unsandboxed & Non Context Isolated) | Chromium | Node.js |