You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Switch to ES modules in Theia 1.77.x: migration and feedback
#18312
With Theia 1.77, the runtime packages (packages/*) are published as ES modules (#18216, #13272).
The build tooling in dev-packages stays CommonJS.
Most applications and extensions keep working without changes:
Every path that was importable before stays importable, including deep imports such as @theia/core/lib/browser/....
Extensions written as CommonJS keep working, both in bundled applications and with Node 24 (e.g. in unit tests).
Plugins (VS Code extensions and Theia plugins) are not affected.
Check your code for these:
Import shared libraries through @theia/core/shared/* (e.g. @theia/core/shared/inversify), never directly. Importing them directly loads a second copy, which breaks dependency injection.
Theia no longer emits decorator metadata. Use @inject on every constructor parameter.
Customizations in esbuild.mjs that rely on require or module.exports in the generated src-gen entry points need to be adapted.
In unit tests, stubbing exports of ES modules with sinon.stub no longer works.
All the details, plus scripts for converting your own extensions to ES modules, are in the migration guide.
Open pull requests: the change touches almost every file in packages/*, so most open PRs will have conflicts and need a rebase. Relative imports now need a .js extension. The codemod scripts/esm/to-esm.mjs adds them automatically: run node scripts/esm/to-esm.mjs --apply packages/<name> for the packages your PR changes.
Try it early: the change is included from 1.77.0-next.101 on (npm install @theia/core@next, likewise for the other @theia/* packages). If something breaks or is unclear, please comment here, so we can fix problems quickly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Discussion
With Theia 1.77, the runtime packages (
packages/*) are published as ES modules (#18216, #13272).The build tooling in
dev-packagesstays CommonJS.Most applications and extensions keep working without changes:
@theia/core/lib/browser/....Check your code for these:
@theia/core/shared/*(e.g.@theia/core/shared/inversify), never directly. Importing them directly loads a second copy, which breaks dependency injection.@injecton every constructor parameter.esbuild.mjsthat rely onrequireormodule.exportsin the generatedsrc-genentry points need to be adapted.sinon.stubno longer works.All the details, plus scripts for converting your own extensions to ES modules, are in the migration guide.
Open pull requests: the change touches almost every file in
packages/*, so most open PRs will have conflicts and need a rebase. Relative imports now need a.jsextension. The codemodscripts/esm/to-esm.mjsadds them automatically: runnode scripts/esm/to-esm.mjs --apply packages/<name>for the packages your PR changes.Try it early: the change is included from
1.77.0-next.101on (npm install @theia/core@next, likewise for the other@theia/*packages). If something breaks or is unclear, please comment here, so we can fix problems quickly.All reactions