Skip to content

test(deconflict): pin renaming the external process binding away from the global - #10702

Merged
graphite-app[bot] merged 1 commit into
mainfrom
test/issue-5449-global-process-shadow
Aug 19, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
test/issue-5449-global-process-shadow

Conversation

@hyfdev

@hyfdev hyfdev commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

With format: 'cjs' and code splitting disabled, a bundle whose dynamically imported modules collapse into the entry chunk used to crash at runtime when one merged module imported process as an external and another called process.on(...) on the global (#5449).

This PR adds a regression test that executes that exact shape and pins the fixed output.

Before (≤ 1.0.0-beta.45), the entry chunk shadowed the global:

let process = require("process");
process = __toESM(process);
// another module in the same chunk:
process.on("beforeExit", () => {});
// TypeError: Cannot set property _eventsCount of #<process> which has only a getter

//   After (≥ 1.0.0-beta.51, fixed by #7022):

let process$1 = require("process");
process$1 = __toESM(process$1);
process.on("beforeExit", () => {}); // reaches the real global

@netlify

netlify Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit e0fd92e
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a850f10ce77810008c6296c

@hyfdev
hyfdev marked this pull request as ready for review August 18, 2026 15:53
Copilot AI lite review requested due to automatic review settings August 18, 2026 15:53

hyfdev commented Aug 18, 2026 •

Copy link
Copy Markdown
Member Author

Merge activity

  • Aug 18, 3:53 PM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 19, 2:03 AM UTC: hyfdev added this pull request to the Graphite merge queue.
  • Aug 19, 2:11 AM UTC: Merged by the Graphite merge queue.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a regression fixture for issue #5449 to ensure that, in CJS output with codeSplitting: false, deconflicting of an external process import does not shadow Node’s global process, preventing the runtime process.on(...) crash described in the issue.

Changes:

  • Adds a minimal repro with two dynamic imports that are forced to merge into the entry chunk (code splitting disabled).
  • Verifies runtime behavior via _test.mjs (global process is usable; imported process is still accessible).
  • Pins the generated output via artifacts.snap to lock in the deconflicted name (process$1) behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rolldown/tests/rolldown/issues/5449/process-importer.js Imports process as an external and stores its PID on globalThis for verification.
crates/rolldown/tests/rolldown/issues/5449/global-user.js Uses the global process.on(...) to ensure it is not shadowed by the external binding.
crates/rolldown/tests/rolldown/issues/5449/main.js Triggers the “merged dynamic imports into entry chunk” shape via Promise.all(import(...)).
crates/rolldown/tests/rolldown/issues/5449/_test.mjs Executes the built CJS bundle and asserts both global and imported process behaviors.
crates/rolldown/tests/rolldown/issues/5449/_config.json Configures format: "cjs" and disables code splitting to reproduce the problematic merge shape.
crates/rolldown/tests/rolldown/issues/5449/artifacts.snap Snapshot of the compiled output, pinning the deconflicted external binding name away from process.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/rolldown/tests/rolldown/issues/5449/_test.mjs Outdated
… the global (#10702)

With `format: 'cjs'` and code splitting disabled, a bundle whose dynamically imported modules collapse into the entry chunk used to crash at runtime when one merged module imported `process` as an external and another called `process.on(...)` on the global (#5449).

This PR adds a regression test that executes that exact shape and pins the fixed output.

Before (≤ 1.0.0-beta.45), the entry chunk shadowed the global:

  ```js
  let process = require("process");
  process = __toESM(process);
  // another module in the same chunk:
  process.on("beforeExit", () => {});
  // TypeError: Cannot set property _eventsCount of #<process> which has only a getter

//   After (≥ 1.0.0-beta.51, fixed by #7022):

  let process$1 = require("process");
  process$1 = __toESM(process$1);
  process.on("beforeExit", () => {}); // reaches the real global
@graphite-app
graphite-app Bot force-pushed the test/issue-5449-global-process-shadow branch from 8c6ee54 to e0fd92e Compare August 19, 2026 02:03
@graphite-app
graphite-app Bot merged commit e0fd92e into main Aug 19, 2026
35 checks passed
@graphite-app
graphite-app Bot deleted the test/issue-5449-global-process-shadow branch August 19, 2026 02:11
@rolldown-guard rolldown-guard Bot mentioned this pull request Aug 19, 2026
shulaoda added a commit that referenced this pull request Aug 19, 2026
## [1.2.5] - 2026-08-19

### 🚀 Features

- bench: record per-suite peak memory in the node benchmark (#10704) by @IWANABETHATGUY
- binding: allocation-tracking global allocator behind the `tracking_allocator` feature (#10703) by @IWANABETHATGUY
- add armv7 android (armv7-linux-androideabi) support (#10691) by @shulaoda
- add `NAMESPACE_CONFLICT` warning for conflicting star re-exports (#7452) by @AliceLanniste

### 🐛 Bug Fixes

- rolldown_plugin_vite_reporter: avoid ANSI erase-line escape in non-TTY output (#10692) by @shulaoda
- rolldown_plugin_vite_resolve: preserve Yarn PnP virtual importer (#10591) by @Freakazo
- exclude hash placeholders from case-insensitive filename deconfliction (#10590) by @Nic-Polumeyv
- code-splitting: fold already-loaded side-effectful libraries into eager entries (#10645) by @JoviDeCroock
- dev: flush re-emitted assets when their content changes (#10637) by @btea
- renamer: rename nested `require`/`__filename`/`__dirname` bindings in CJS output (#10655) by @marcoroth
- silence two wasm-only warnings (#10668) by @IWANABETHATGUY

### 🚜 Refactor

- skip case folding for filenames with hash placeholders (#10689) by @hyfdev
- code-splitting: remove redundant synthetic statement owner (#10503) by @hyfdev
- renamer: move the cjs check into `rename_bindings_shadowing_cjs_ambient_names` (#10672) by @IWANABETHATGUY

### 📚 Documentation

- agents: point the never-edit list at the binding files that exist (#10719) by @melbinjp

### 🧪 Testing

- deconflict: pin renaming the external process binding away from the global (#10702) by @hyfdev
- dev: expect a hot update across a circular import (#10700) by @hyfdev

### ⚙️ Miscellaneous Tasks

- deps: upgrade oxc to 0.146.0 (#10707) by @Boshen
- deps: update rust crates (#10684) by @renovate[bot]
- deps: update npm packages (#10685) by @renovate[bot]
- build the benchmark comparison window from the JSON lines (#10701) by @IWANABETHATGUY
- wasi: retry the Node Test step to absorb the shared-dlmalloc flake (#10699) by @hyfdev
- append benchmark results to storage as JSON lines (#10682) by @IWANABETHATGUY
- deps: update github actions (#10683) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.28.2 (#10679) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.28.1 (#10674) by @renovate[bot]

### ❤️ New Contributors

* @melbinjp made their first contribution in [#10719](#10719)
* @Freakazo made their first contribution in [#10591](#10591)
* @marcoroth made their first contribution in [#10655](#10655)

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo