Skip to content

chore: v27 migration to node22 ESM package#9544

Merged
mmaietta merged 9 commits into
masterfrom
chore/esm-migration
Jun 10, 2026
Merged

chore: v27 migration to node22 ESM package#9544
mmaietta merged 9 commits into
masterfrom
chore/esm-migration

Conversation

@mmaietta

@mmaietta mmaietta commented Jan 28, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces major breaking changes as part of the v27 release, migrating the entire electron-builder ecosystem to native ES modules (ESM) and requiring Node.js >=22.12.0. It removes legacy dependencies, updates package configurations, and improves developer tooling and documentation to reflect these changes. The migration is designed to be as smooth as possible, with continued support for CommonJS (require()) on supported Node versions, but projects using deprecated features will need to update.

Breaking changes and ESM migration:

  • All packages now use native ES modules ("type": "module"), and Node.js >=22.12.0 is required. The electronCompile config option and the electron-compile dependency are fully removed. The four electron-forge-maker-* plugins are now ESM. A comprehensive migration guide is added in MIGRATION.md, and the README is updated with requirements and usage examples for both ESM and CJS.

  • The minimum Node.js version is enforced in package.json (>=22.12.0) and documentation; CI and workflow files are updated to target Node 22.

Package and build system updates:

  • The build output is moved from out to dist, and package exports are restructured to provide both public and internal entry points. A new @electron-builder/app-builder-lib-helpers package is added for workspace-internal sharing.

  • Scripts are updated to use tsx instead of ts-node, add new build/watch/typecheck scripts, and handle errors more gracefully in schema generation. ESLint and Prettier ignore patterns are updated to match new output locations.

API and schema changes:

  • The electronCompile configuration option is removed from the JSON schema, and the schema is updated for ESM compatibility.

  • Source files are updated to use explicit ESM imports (with .js extensions), and helper scripts are migrated to use dynamic import() instead of require().

Release and versioning changes:

  • Changeset configuration and pre-release metadata are updated to include new packages and mark the release as alpha.

Documentation improvements:

  • The migration guide and README are updated to clearly explain the breaking changes, migration steps, and provide new usage examples for both ESM and CJS.

@changeset-bot

changeset-bot Bot commented Jan 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 75036c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
electron-builder-squirrel-windows Major
builder-util-runtime Major
electron-builder Major
electron-publish Major
electron-updater Major
app-builder-lib Major
builder-util Major
dmg-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis Major
electron-forge-maker-nsis-web Major
electron-forge-maker-snap Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@socket-security

socket-security Bot commented Jan 28, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​tsconfig/​node22@​22.0.51001007083100
Addedtsx@​4.22.41001008293100
Addedfs-extra@​11.3.510010010088100

View full report

@socket-security

socket-security Bot commented Jan 29, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@mmaietta mmaietta changed the base branch from master to release/v27 February 20, 2026 21:25
dennisameling referenced this pull request in signalapp/Signal-Desktop Apr 28, 2026
@mmaietta mmaietta force-pushed the chore/esm-migration branch from 52191a7 to 3b38b0e Compare May 2, 2026 15:51
@mmaietta mmaietta changed the base branch from release/v27 to master May 3, 2026 00:18
@mmaietta mmaietta changed the title chore: v27 migration to ESM [WIP] (BREAKING) chore: v27 migration to ESM-only package (BREAKING) May 4, 2026
@mmaietta mmaietta marked this pull request as ready for review May 6, 2026 14:48
Comment thread packages/app-builder-lib/src/targets/AppImageTarget.ts Outdated
Comment thread packages/electron-updater/package.json Outdated
Comment thread packages/app-builder-lib/package.json Outdated
Comment thread test/vitest-scripts/run-vitest.ts Fixed
@mmaietta mmaietta changed the title chore: v27 migration to ESM-only package (BREAKING) chore: v27 migration to ESM-only package Jun 4, 2026
@mmaietta mmaietta requested a review from Copilot June 5, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@mmaietta

mmaietta commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

For visibility on code line diff count

Directory Insertions Deletions
packages/ +1860 -1379
test/ +825 -1368
git diff master...HEAD --numstat | awk '
  /^[0-9]/ && $3 ~ /^packages\// { pkg_add+=$1; pkg_del+=$2 }
  /^[0-9]/ && $3 ~ /^test\//     { tst_add+=$1; tst_del+=$2 }
  END {
    print "packages/  +" pkg_add " -" pkg_del
    print "test/      +" tst_add " -" tst_del
  }
'

@mmaietta mmaietta changed the title chore: v27 migration to ESM-only package chore: v27 migration to node22 ESM package Jun 6, 2026
…7 release, migrating the entire `electron-builder` ecosystem to native ES modules and requiring Node.js >=22.12.0. It also removes support for `electron-compile`, updates documentation and configuration files, and adjusts build/test tooling for the new requirements. Most users will only need to upgrade their Node.js version, but some migration steps may be required for projects using deprecated features.

**Breaking changes and migration to ESM:**
- All packages now use native ES modules (`"type": "module"`), and require Node.js >=22.12.0. CJS `require()` continues to work on supported Node versions, but `electronCompile` support is fully removed. See the new `MIGRATION.md` and updated [README](./README.md) for guidance.
- The `electronCompile` configuration option and all related code/schema have been removed.
- The four Electron Forge maker plugins are now ESM-only, but their API remains unchanged.

**Build and test tooling updates:**
- The minimum required Node.js version is now 22.12.0, and the minimum `pnpm` version is 11.1.0. Updated scripts use `tsx` for test scripts instead of `ts-node`.
- The `compile` and related scripts have been updated to build all relevant packages in the correct order for ESM.
- Added `@tsconfig/node22` to dev dependencies and updated TypeScript and Prettier ignore patterns for new `dist` output.

**Package and configuration updates:**
- Added a new internal helper package `@electron-builder/app-builder-lib-helpers` for workspace sharing.
- Updated `app-builder-lib/package.json` to ESM, with new `exports` and `types` fields, and new build/watch scripts. Updated dependencies and peer dependencies for compatibility.
- Updated ESLint configuration for new output paths and relaxed some stylistic rules for test files.

**Documentation and workflow changes:**
- Added a comprehensive migration guide (`MIGRATION.md`) and updated the main `README.md` to highlight new requirements and usage patterns.
mmaietta and others added 8 commits June 7, 2026 17:31
Resolved conflicts by keeping ESM-specific additions (type: module, exports,
dist/ paths, Node >=22.12.0 engine) from this branch while accepting master's
version bump (26.15.1 → 26.15.3), yarn.ts retry import, and new
docs/features/build-lifecycle.md. Regenerated pnpm-lock.yaml via pnpm install.
…sc --build

Previously `tsc` and `tsc --build --watch` from the repo root did not work
because the per-package `tsconfig.build.json` files had `composite: false`,
disqualifying them from TypeScript project references. The compile pipeline
was a hand-ordered sequence of per-package `pnpm run build` invocations, and
an `incremental: true` attempt introduced a regression where `.tsbuildinfo`
landed in the package root (not `dist/`), causing TypeScript to skip emission
after `dist/` was cleaned.

Changes:
- `packages/tsconfig-build.json`: `composite: true` (replaces
  `composite: false, incremental: false/true`); `composite` implies incremental
  and with `outDir` set places `.tsbuildinfo` correctly
- `.gitignore`: broaden `tsconfig.tsbuildinfo` → `*.tsbuildinfo` to cover
  the `tsconfig.build.tsbuildinfo` filenames generated per composite project
- New root `tsconfig.build.json`: `files: []` + references to all eight
  package `tsconfig.build.json` files; entry point for `tsc --build`
- Each package's `tsconfig.build.json`: added `references` mirroring the
  existing per-package `tsconfig.json` cross-package dependency graph
- Root `compile` script: replaced multi-step `pnpm run -r … build` chain
  with `pnpm ci:test:generate && tsc --build tsconfig.build.json --force`
- Root `compile:watch` script: replaced `pnpm compile && pnpm run -r --parallel watch`
  with `tsc --build tsconfig.build.json --watch`
- Per-package `build`/`watch` scripts: replaced `rmSync + tsc -p …` with
  `tsc --build tsconfig.build.json --force` / `--watch`
- Delete `packageDependencies.ts` (no remaining importers)

`tsc --build tsconfig.build.json` and `tsc --build tsconfig.build.json --watch`
now work from the repo root. TypeScript enforces build order through the
reference graph and correctly surfaces missing-import errors when source files
are deleted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d/` tests via TestSuite to split/handle various toolset version combinations)
@mmaietta mmaietta merged commit a5121de into master Jun 10, 2026
59 checks passed
@mmaietta mmaietta deleted the chore/esm-migration branch June 10, 2026 10:44
mmaietta added a commit that referenced this pull request Jun 19, 2026
Resolve conflicts from the v27 ESM migration (#9544):
- linuxPackager.ts: combine ESM imports (.js, builder-util/internal,
  targets/linux/*) with the desktop-emission pack() override
- LinuxTargetHelper.ts (moved to targets/linux/): keep desktop boolean
  normalization + InvalidConfigurationError for desktop.entry.Exec/Comment
  alongside master's desktopName validation
- platformPackager.ts: cast `this as unknown as LinuxPackager` now that
  LinuxPackager has extra private members (getHelper/_helper/emittedDesktopFiles)
- scheme.json: regenerated (desktop now LinuxDesktopFile | boolean | null)
- tests: drop linuxPackagerTest.js.snap (deleted upstream) and reduce
  linuxPackagerTest.ts to the new archive/desktop coverage; AppImage/icon/
  license cases already live in linuxPackagerTestSuite.ts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FYI/PSA: ESM-only + Node >22 engine upcoming in next major semver, v27

4 participants