Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork200
Open
Milestone
Description
More and more npm packages are shipping as ESM. In node, the compatibility between ESM and CommonJS has some limitation:
- an ES module can import a CommonJS module
- an ES module can dynamically import a CommonJS module
- a CommonJS module cannot import an ES module (Node 22 has anexperimental feature allowing it for synchronous object graphs, i.e. ES modules that don't use top-level await)
- a CommonJS module can dynamically import an ES module through
await import(...)
(but this can only be used in an async context)
Shipping Encore as a CommonJS module means that we cannot upgrade our dependencies to versions that have migrated to ESM (asEncore.getConfig()
is a synchronous API, any solution requiring an async context is a no-go).
Migrating to ESM needs to be done in a new major version as it is a BC break for downstream projects. This will require writing thewebpack.config.js
file in ESM, either by usingtype=module
in the package.json or by usingwebpack.config.mjs
instead (which is supported by webpack)
Metadata
Metadata
Assignees
Labels
No labels