Skip to content

fix(dev): force a full rebuild when a tsconfig changes#10261

Merged
graphite-app[bot] merged 1 commit into
mainfrom
07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes
Jul 14, 2026
Merged

fix(dev): force a full rebuild when a tsconfig changes#10261
graphite-app[bot] merged 1 commit into
mainfrom
07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes

Conversation

@shulaoda

@shulaoda shulaoda commented Jul 13, 2026

Copy link
Copy Markdown
Member

Part of #9598, on top of #10258. Addresses the review comment there about the dev API.

After #10258 the dev engine watches tsconfig files, but being watched is not enough: a tsconfig is neither a module nor a transform dependency, so the HMR mapper observes the change and maps it to Noop, and dev output keeps the old transform and resolution results. A tsconfig edit affects every module the tsconfig governs, which neither an HMR patch nor a partial scan can represent, so the only correct reaction is a full rebuild with fresh caches.

Discovered tsconfig paths are remembered in a set on RawTransformOptions that discover_tsconfig_file fills during watch registration. The set deliberately survives clear_cache, so the bundling task can still classify a changed path after the caches were dropped. When a changed file hits the set, the bundling task clears the resolver and tsconfig caches and upgrades itself to TaskInput::FullBuild.

Registering the tsconfig as a transform dependency was considered and rejected: the HMR mapper would patch every module the tsconfig governs instead of doing one clean rebuild, and a pure Hmr task never clears the caches, so those patches would still use the stale options.

Review notes: detection lives in BundlingTask, not the coordinator, because the coordinator must not lock the bundler while a running build holds the lock. The upgrade happens after the watchChange hooks so they still see the changed files. The coordinator reads requires_full_rebuild() only at scheduling time, so a task that upgrades itself mid-run completes through the normal InProgress path.

Client notification (a FullReload update so browsers refresh automatically) and the dev fixtures come in a follow-up.

shulaoda commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 7 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes (39f5019) with 07-13-fix_watch_rebuild_when_tsconfig_files_change (9a56c40)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread crates/rolldown_dev/src/bundling_task.rs

shulaoda commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jul 14, 6:10 AM 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.
  • Jul 14, 7:44 AM UTC: shulaoda added this pull request to the Graphite merge queue.
  • Jul 14, 7:49 AM UTC: Merged by the Graphite merge queue.

@shulaoda
shulaoda force-pushed the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch from 39f5019 to a0be807 Compare July 14, 2026 06:37
@shulaoda
shulaoda force-pushed the 07-13-fix_watch_rebuild_when_tsconfig_files_change branch from 9a56c40 to 79c794b Compare July 14, 2026 06:37
@graphite-app
graphite-app Bot force-pushed the 07-13-fix_watch_rebuild_when_tsconfig_files_change branch 2 times, most recently from fa6aeb9 to c30c2f6 Compare July 14, 2026 06:51
@graphite-app
graphite-app Bot force-pushed the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch from a0be807 to 2e8179b Compare July 14, 2026 06:51
@graphite-app
graphite-app Bot changed the base branch from 07-13-fix_watch_rebuild_when_tsconfig_files_change to graphite-base/10261 July 14, 2026 07:02
@graphite-app
graphite-app Bot force-pushed the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch from 2e8179b to d97d9b5 Compare July 14, 2026 07:06
@graphite-app
graphite-app Bot force-pushed the graphite-base/10261 branch from c30c2f6 to fd6a0d0 Compare July 14, 2026 07:06
@graphite-app
graphite-app Bot changed the base branch from graphite-base/10261 to main July 14, 2026 07:07
@graphite-app
graphite-app Bot force-pushed the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch from d97d9b5 to 4a8a396 Compare July 14, 2026 07:07
@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for rolldown-rs ready!

Name Link
🔨 Latest commit 9f4030d
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/6a55e9064efb5c0008a2ab6a
😎 Deploy Preview https://deploy-preview-10261--rolldown-rs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Part of #9598, on top of #10258. Addresses the review comment there about the dev API.

After #10258 the dev engine watches tsconfig files, but being watched is not enough: a tsconfig is neither a module nor a transform dependency, so the HMR mapper observes the change and maps it to `Noop`, and dev output keeps the old transform and resolution results. A tsconfig edit affects every module the tsconfig governs, which neither an HMR patch nor a partial scan can represent, so the only correct reaction is a full rebuild with fresh caches.

Discovered tsconfig paths are remembered in a set on `RawTransformOptions` that `discover_tsconfig_file` fills during watch registration. The set deliberately survives `clear_cache`, so the bundling task can still classify a changed path after the caches were dropped. When a changed file hits the set, the bundling task clears the resolver and tsconfig caches and upgrades itself to `TaskInput::FullBuild`.

Registering the tsconfig as a transform dependency was considered and rejected: the HMR mapper would patch every module the tsconfig governs instead of doing one clean rebuild, and a pure `Hmr` task never clears the caches, so those patches would still use the stale options.

Review notes: detection lives in `BundlingTask`, not the coordinator, because the coordinator must not lock the bundler while a running build holds the lock. The upgrade happens after the `watchChange` hooks so they still see the changed files. The coordinator reads `requires_full_rebuild()` only at scheduling time, so a task that upgrades itself mid-run completes through the normal `InProgress` path.

Client notification (a `FullReload` update so browsers refresh automatically) and the dev fixtures come in a follow-up.

<!--
- What is this PR solving? Write a clear and concise description.
- Reference the issues it solves (e.g. `fixes #123`).
- What other alternatives have you explored?
- Are there any parts you think require more attention from reviewers?

Also, please make sure you do the following:

- Read the Contributing Guidelines at https://rolldown.rs/contribution-guide/.
- Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us review it.
- Update the corresponding documentation if needed.
- Include relevant tests that fail without this PR but pass with it. If the tests are not included, explain why.

Thank you for contributing to Rolldown!
-->
@graphite-app
graphite-app Bot force-pushed the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch from 4a8a396 to 9f4030d Compare July 14, 2026 07:45
@graphite-app
graphite-app Bot merged commit 9f4030d into main Jul 14, 2026
33 of 34 checks passed
@graphite-app
graphite-app Bot deleted the 07-13-fix_dev_force_a_full_rebuild_when_a_tsconfig_changes branch July 14, 2026 07:49
@rolldown-guard rolldown-guard Bot mentioned this pull request Jul 15, 2026
shulaoda added a commit that referenced this pull request Jul 15, 2026
## [1.2.0] - 2026-07-15

### 🚀 Features

- dev: skip shipping factories for newly imported top-level modules (#10223) by @h-a-n-a
- dev: per-client ship map for HMR patch sizing (#10208) by @h-a-n-a
- dev: client-side HMR (#10164) by @h-a-n-a
- dev: send a full-reload update to clients when a tsconfig changes (#10262) by @shulaoda
- treat `import.meta['url']` and `import.meta['ROLLUP_FILE_URL_*']` as side-effect free (#10267) by @sapphi-red
- rewrite `import.meta['url']` (#10251) by @sapphi-red
- add `FILE_NOT_FOUND` error (#10220) by @sapphi-red
- treat `import.meta.ROLLUP_FILE_URL_*` as side-effect free (#10217) by @sapphi-red

### 🐛 Bug Fixes

- sourcemap: preserve unmapped boundaries during composition (#10254) by @hyfdev
- `[format]` in `*FileNames` option for ESM format should be `es` instead of `esm` (#10214) by @sapphi-red
- sourcemap: preserve coarse mappings during composition (#10249) by @hyfdev
- rolldown_plugin_vite_import_glob: support tsconfig paths with `import.meta.glob` (#10167) by @sapphi-red
- dev: clear tsconfig caches for bare full builds (#10276) by @shulaoda
- dev: force a full rebuild when a tsconfig changes (#10261) by @shulaoda
- treat rooted drive-less module ids as absolute in preserveModules naming (#10235) by @IWANABETHATGUY
- watch: rebuild when tsconfig files change (#10258) by @shulaoda
- watch: drop tsconfig-merged transform options on each rebuild (#10257) by @shulaoda
- incorrect `EMPTY_IMPORT_META` warning for `import.meta.ROLLUP_FILE_URL_*` for CJS output (#10221) by @sapphi-red
- deconflict: rename CJS locals shadowing wrapped-ESM namespace objects (#9970) by @IWANABETHATGUY
- rolldown: drop the unused runtime module after entry-level external flattening (#10237) by @IWANABETHATGUY
- rolldown: re-propagate has_dynamic_exports to transitive star importers (#10239) by @IWANABETHATGUY
- tree-shaking: tree-shake destructured dynamic import namespace bindings (#10213) by @logaretm
- s390x: use json-escape-simd 3.1.1 for big-endian JSON escaping fix (#10211) by @satyamg1620

### 🚜 Refactor

- dev: move full-reload to client side (#10207) by @h-a-n-a
- readability follow-ups to the ReplaceWith migration (#10286) by @IWANABETHATGUY
- replace take_in-then-write-back with ReplaceWith and by-value moves (#10285) by @Boshen
- share the main resolver's cache with the transformer's tsconfig lookups (#10205) by @shulaoda
- rolldown: extract the ns star-external __reExport emission rule into LinkingMetadata (#10238) by @IWANABETHATGUY
- rolldown: unify link/generate diagnostics into a Diagnostics accumulator (#10234) by @IWANABETHATGUY
- sourcemap_filenames: drop dead sourcemap-filename plumbing (#10189) by @IWANABETHATGUY
- extract external import symbol merging into a method (#10224) by @IWANABETHATGUY
- rolldown: skip CJS namespace merging under strict execution order (#10203) by @hyfdev
- resolve the manual tsconfig per file instead of once at startup (#10200) by @shulaoda
- rolldown: route interop ESM init emission through a shared init-target view (#10202) by @hyfdev
- rolldown: collapse vestigial wrap-kind state and share chunk sort helper (#10201) by @hyfdev

### 📚 Documentation

- show plugin kinds in JSDoc and each hook's description (#10218) by @sapphi-red
- add an explanation about removing imports from external modules without any messages (#10215) by @sapphi-red

### ⚡ Performance

- sourcemap: owned merge in SourceJoiner::join (4005->5 allocs/chunk) (#10250) by @Boshen
- avoid redundant sourcemap string copies in collapse and minify paths (#10093) by @Boshen

### 🧪 Testing

- code-splitting: establish strict-order review baselines (#10287) by @hyfdev
- dev: add hot API test cases (#10181) by @h-a-n-a
- code-splitting: normalize strict execution order variants (#10277) by @hyfdev
- code-splitting: harden strict execution order coverage (#10252) by @hyfdev
- code-splitting: add strict execution order regressions (#10253) by @hyfdev

### ⚙️ Miscellaneous Tasks

- deps: update github actions (#10241) by @renovate[bot]
- deps: update oxc to 0.140.0 (#10274) by @shulaoda
- update Yunfei's GitHub username (#10275) by @hyfdev
- deps: update napi (#10260) by @renovate[bot]
- deps: update test262 submodule for tests (#10266) by @rolldown-guard[bot]
- deps: update dependency vite-plus to v0.2.4 (#10256) by @renovate[bot]
- deps: update napi (#10240) by @renovate[bot]
- deps: update oxc resolver to v11.24.2 (#10245) by @renovate[bot]
- deps: update rust crates (#10244) by @renovate[bot]
- disable Renovate updates for idna_adapter (#10248) by @shulaoda
- deps: update oxc resolver to v11.24.1 (#10232) by @renovate[bot]
- deps: update rust crate oxc_sourcemap to v8.1.1 (#10233) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.27.0 (#10206) by @renovate[bot]
- deps: upgrade sugar_path to v3 (#10230) by @hyfdev
- add `dist-*` to `.gitignore` in sourcemap-filenames/hash-final-content fixture (#10216) by @sapphi-red
- deps: update dependency rust to v1.97.0 (#10209) by @renovate[bot]

### ❤️ New Contributors

* @satyamg1620 made their first contribution in [#10211](#10211)

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