feat(core): reuse Rsbuild restart lifecycle - #1782
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates Rslib’s restart behavior for build --watch / dev server scenarios to Rsbuild v2.1.7’s restart lifecycle, removing the custom chokidar-based implementation and aligning restarts/cleanup with Rsbuild.
Changes:
- Remove the custom restart watcher (
packages/core/src/restart.ts) and drop the directchokidardependency. - Forward restart handling into Rsbuild (
restartcallback), and register env files asdev.watchFilesrestart inputs. - Add/adjust integration tests to cover config/env/custom
dev.watchFilesrestart behavior.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/cli/restart/src/index.ts | Adds a minimal source file for the new restart integration fixture. |
| tests/integration/cli/restart/rslib.config.ts | Adds fixture config covering dev.watchFiles (restart type) + onRestart. |
| tests/integration/cli/restart/index.test.ts | Adds integration coverage asserting restart behavior/logs on watched-file changes. |
| tests/integration/cli/build/build.test.ts | Updates snapshots for _privateMeta changes (removes envFilePaths). |
| tests/integration/cli/build-watch/build.test.ts | Updates watch-mode integration test to assert restart-on-config-change behavior. |
| packages/core/tests/config.test.ts | Updates snapshots for _privateMeta changes (removes envFilePaths). |
| packages/core/src/utils/helper.ts | Removes now-unused debounce and isTTY helpers. |
| packages/core/src/types/rslib.ts | Exposes restart?: RestartFn on CreateRslibOptions. |
| packages/core/src/types/config.ts | Removes _privateMeta from the public RslibConfig type. |
| packages/core/src/restart.ts | Deletes the custom chokidar-based restart implementation. |
| packages/core/src/createRslib.ts | Registers env files into dev.watchFiles (restart type) and forwards _privateMeta + restart to Rsbuild. |
| packages/core/src/cli/init.ts | Implements the Rsbuild RestartFn that re-initializes and re-runs build/dev. |
| packages/core/src/cli/commands.ts | Removes custom restart wiring; delegates restart mechanics to Rsbuild lifecycle. |
| packages/core/package.json | Removes direct chokidar dependency. |
| pnpm-lock.yaml | Updates lockfile for dependency changes and bumps @rsbuild/core to 2.1.7. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
chenjiahan
enabled auto-merge (squash)
July 22, 2026 04:53
Timeless0911
approved these changes
Jul 22, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces Rslib's custom restart watcher with the Rsbuild 2.1.7 restart lifecycle, so configuration, environment file, and
dev.watchFileschanges share Rsbuild's restart and cleanup behavior.chokidardependency.Related Links
https://github.com/web-infra-dev/rsbuild/releases/tag/v2.1.7
Checklist