Files
electron/script
claude[bot]andClaude 7128ee7576 build: bundle lib/ with rolldown instead of webpack (#54080)
* build: bundle lib/ with rolldown instead of webpack

Replace the webpack + ts-loader pipeline that builds Electron's internal
JavaScript bundles with a small rolldown driver (build/bundle/bundle.mjs).

- build/bundle/targets.mjs describes the seven bundles (browser, renderer,
  worker, webview, isolated_renderer, node, utility) and the per-target
  behaviour that used to live in one webpack config each.
- BUILDFLAG(...) folding, the `electron` aliases, the Promise/process/
  Buffer/global providers and the profiling/try-catch wrappers are kept
  with the same semantics. Node built-ins imported from lazily evaluated
  modules stay lazy via a one line CommonJS shim so that load order
  matches the old bundles.
- Type checking moves out of the bundling step into a single
  electron_lib_typecheck action (build/bundle/typecheck.mjs) that every
  bundle depends on, instead of running seven times.
- gen-filenames.ts asks bundle.mjs for the module graph directly and
  emits a lib_typecheck_sources list for the new action.
- A few lib/ modules are adjusted for an ESM-first bundler: net.ts uses
  a plain module.exports object, web-contents.ts keeps its session
  side-effect import explicitly, and defineProperties caches the loaded
  module so each electron.* getter keeps returning the same object.

Drops webpack, webpack-cli and ts-loader from devDependencies.

* chore: wrap comment for clang-format

* build: keep bundle declarations out of the wrapper's parameter scope

node_mksnapshot compiles the js2c bundles with Node's built-in module
parameters (exports, require, module, process, internalBinding,
primordials), and a hoisted top-level `const { internalBinding } = ...`
from lib/node redeclared one of them. Wrap the bundle body in an IIFE, as
the webpack output was.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-18 17:52:57 +02:00
..
2025-05-30 10:59:11 +02:00
2026-03-18 19:14:49 -04:00
2026-02-18 13:24:29 -05:00
2024-03-21 09:48:23 -04:00
2025-12-10 14:04:14 -05:00