Skip to content

feat(core): reuse Rsbuild restart lifecycle - #1782

Merged
chenjiahan merged 2 commits into
mainfrom
chenjiahan/feat-rsbuild-restart
Jul 22, 2026
Merged

chenjiahan merged 2 commits into
mainfrom
chenjiahan/feat-rsbuild-restart

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

This PR replaces Rslib's custom restart watcher with the Rsbuild 2.1.7 restart lifecycle, so configuration, environment file, and dev.watchFiles changes share Rsbuild's restart and cleanup behavior.

  • Remove Rslib's chokidar-based restart implementation and direct chokidar dependency.
  • Forward restart callbacks and config metadata to Rsbuild, and register environment files as restart watch files.
  • Add integration coverage for configuration changes and custom restart watch files.

Related Links

https://github.com/web-infra-dev/rsbuild/releases/tag/v2.1.7

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 22, 2026 03:31

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

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 direct chokidar dependency.
  • Forward restart handling into Rsbuild (restart callback), and register env files as dev.watchFiles restart inputs.
  • Add/adjust integration tests to cover config/env/custom dev.watchFiles restart 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

Comment thread tests/integration/cli/build-watch/build.test.ts Outdated
Comment thread tests/integration/cli/build-watch/build.test.ts
@chenjiahan
chenjiahan requested a review from Timeless0911 July 22, 2026 04:53
@chenjiahan
chenjiahan enabled auto-merge (squash) July 22, 2026 04:53
@chenjiahan
chenjiahan merged commit 2dde853 into main Jul 22, 2026
11 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/feat-rsbuild-restart branch July 22, 2026 05:04
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