Skip to content

test(dev): full-bundle-mode regression test for cyclic import binding (#9946) - #9947

Merged
h-a-n-a merged 2 commits into
rolldown:mainfrom
ShMcK:test/full-bundle-circular-import-binding-9946
Sep 15, 2026
Merged

h-a-n-a merged 2 commits into
rolldown:mainfrom
ShMcK:test/full-bundle-circular-import-binding-9946

Conversation

@ShMcK

@ShMcK ShMcK commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Adds a minimal full-bundle-mode (experimental.devMode) browser playground that
exercises a cyclic import whose binding is used at module init.

Files: a.js -> b.js -> a.js. b.js exports class B; a.js uses it at the top
level:

// a.js
import { B } from './b.js';
export const defaults = { button: B };   // module-init use of a cyclic import

main.js renders button=B. The spec asserts .app reads button=B.

Why

Regression test for #9946. In full-bundle-mode the served chunk references B
but never declares/imports it, so the page throws ReferenceError: B is not defined at load and .app stays empty. Sibling imports used only inside
function bodies bind correctly — only the module-init reference over a cycle
breaks. The same pattern broke @sentry/core (class ServerRuntimeClient extends BaseClient), @datadog/browser-core (ONE_SECOND), and first-party
app code when enabling bundledDev.

Reproduces on the published rolldown 1.1.2. CI here will confirm against
main — if it already passes, the test stands as a regression guard; if it
fails, it's a live repro for #9946.

Related: #9691 (lazy mode drops an import), #9485 (the CJS-interop circular
variant, fixed by #9419 — this pure-ESM module-init case is distinct and still
reproduces on 1.1.2).

@h-a-n-a

h-a-n-a commented Jun 24, 2026

Copy link
Copy Markdown
Member

I'm drafting this as this is not fixed and ready to be reviewed yet.

@h-a-n-a h-a-n-a self-assigned this Jun 25, 2026
ShMcK and others added 2 commits September 14, 2026 18:45
…rolldown#9946)

In full-bundle-mode (experimental.devMode), an imported binding used at module
init inside an import cycle is emitted unbound, throwing
`ReferenceError: <name> is not defined` at load. Adds a minimal browser
playground: a.js -> b.js -> a.js, where a.js uses b.js's `class B` at module
init (`export const defaults = { button: B }`). The page should render
`button=B`; with the bug it stays empty.

Reproduces on rolldown 1.1.2. Refs rolldown#9946.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…n playground

Folds the fixture from rolldown#9947 into the lazy-compilation playground next to the other circular re-export scenarios.

Regression test for rolldown#9946.

Claude-Session: https://claude.ai/code/session_01SyoHH1uZXfLcw2kGkr5yVK
@h-a-n-a
h-a-n-a force-pushed the test/full-bundle-circular-import-binding-9946 branch from 2db54d4 to a661207 Compare September 14, 2026 14:39
@h-a-n-a
h-a-n-a marked this pull request as ready for review September 15, 2026 02:12
@h-a-n-a
h-a-n-a enabled auto-merge (squash) September 15, 2026 02:12
@h-a-n-a
h-a-n-a merged commit 1823483 into rolldown:main Sep 15, 2026
65 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a661207eaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import { page, serverUrl, waitForBuildStable } from '~utils';

// https://github.com/rolldown/rolldown/issues/9946
describe('lazy-compilation: circular import binding', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document the new lazy-compilation regression coverage

This adds a new lazy-compilation E2E scenario, but the explicit Test Coverage table in internal-docs/lazy-compilation/implementation.md remains unchanged and therefore omits circular-import-binding and the #9946 invariant. Add this scenario to that table so the implementation documentation stays synchronized with the test suite.

AGENTS.md reference: AGENTS.md:L20-L21

Useful? React with 👍 / 👎.

@rolldown-guard rolldown-guard Bot mentioned this pull request Sep 16, 2026
shulaoda added a commit that referenced this pull request Sep 16, 2026
## [1.2.9] - 2026-09-16

### 🚀 Features

- add `MODULE_LEVEL_DIRECTIVE` warning (#10791) by @sapphi-red

### 🐛 Bug Fixes

- handle CommonJS exports through top-level `this` (#10872) by @IWANABETHATGUY
- scripts: make setup-vite CLI invocation work on Windows (#10885) by @shulaoda
- remove deleted property from output bundle proxy target (#10815) by @Vladexy88x
- treat module-scope `await using` as top-level await (#10739) by @MarshallOfSound
- watch: preserve plugin attribution in warnings (#10473) by @Nic-Polumeyv
- test-dev-server: link the workspace rolldown before building vite (#10857) by @h-a-n-a
- minify: preserve annotation comments when minified (#10854) (#10855) by @justonemorenight

### ⚡ Performance

- dev/lazy: fetch a lazy route in one request (#10789) by @h-a-n-a
- plugin: reduce binding binary size (#10776) by @Boshen
- vite-reporter: reuse emitted sourcemap sizes (#10841) by @hyfdev

### 🧪 Testing

- dev: full-bundle-mode regression test for cyclic import binding (#9946) (#9947) by @ShMcK
- cover asset option callback timings (#10870) by @IWANABETHATGUY

### ⚙️ Miscellaneous Tasks

- wait for npm bindings before publishing rolldown (#10866) by @shulaoda
- deps: update dependency @napi-rs/cli to v3.10.1 (#10889) by @renovate[bot]
- deps: update napi (#10888) by @renovate[bot]
- compress debug info archives with zstd (#10778) by @IWANABETHATGUY
- publish split debug info for release bindings (#10777) by @IWANABETHATGUY
- rolldown_utils: simplify MIME guessing and remove UTF-8 check bypass (#10884) by @shulaoda
- add npm bugs metadata for rolldown (#9694) by @kingshuaishuai
- deps: upgrade oxc to 0.150.0 (#10877) by @camc314
- deps: update rust crates (#10869) by @renovate[bot]
- deps: update dependency vite-plus to v0.3.2 (#10878) by @renovate[bot]
- deps: update rollup submodule for tests to v4.63.3 (#10880) by @rolldown-guard[bot]
- deps: update test262 submodule for tests (#10881) by @rolldown-guard[bot]
- deps: update github actions (#10867) by @renovate[bot]
- deps: update npm packages (#10868) by @renovate[bot]
- deps: update napi to v3.12.4 (#10862) by @renovate[bot]
- deps: update napi (#10861) by @renovate[bot]

### ❤️ New Contributors

* @Vladexy88x made their first contribution in [#10815](#10815)
* @MarshallOfSound made their first contribution in [#10739](#10739)
* @kingshuaishuai made their first contribution in [#9694](#9694)
* @ShMcK made their first contribution in [#9947](#9947)
* @justonemorenight made their first contribution in [#10855](#10855)

Co-authored-by: shulaoda <[email protected]>
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.

2 participants