feat: add new onAfterDevCompile plugin hook#5882
Merged
chenjiahan merged 1 commit intomainfrom Aug 19, 2025
Merged
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new onAfterDevCompile plugin hook to replace the existing onDevCompileDone hook for consistency in naming conventions. The previous hook remains available as a deprecated alias.
- Adds new
onAfterDevCompilehook with identical functionality toonDevCompileDone - Deprecates
onDevCompileDonewhile maintaining backward compatibility as an alias - Updates all internal usage and tests to use the new hook name
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/plugin.ts | Adds new hook type and updates documentation with deprecation notice |
| packages/core/src/types/hooks.ts | Renames hook function type and updates comment references |
| packages/core/src/hooks.ts | Replaces hook implementation and updates internal usage |
| packages/core/src/initPlugins.ts | Maps new hook and creates alias for backward compatibility |
| packages/core/src/createRsbuild.ts | Exposes new hook in RsbuildInstance interface |
| packages/core/src/server/devServer.ts | Updates internal hook usage with comment |
| packages/core/src/index.ts | Updates type exports |
| e2e/helper/jsApi.ts | Updates test helper to use new hook |
| e2e/helper/utils.ts | Adds new hook to test recorder and fixes naming inconsistencies |
| e2e/cases/rspack-profile/dev.mjs | Updates example usage |
| e2e/cases/plugin-api/plugin-hooks/index.test.ts | Updates test expectations |
| e2e/cases/plugin-api/plugin-hooks-environment/index.test.ts | Updates test expectations and adds new hook |
| e2e/cases/output/manifest-environment/index.test.ts | Updates test to use new hook |
| packages/core/tests/snapshots/hooks.test.ts.snap | Updates test snapshot |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
9aoy
reviewed
Aug 19, 2025
9aoy
approved these changes
Aug 19, 2025
This was referenced Aug 19, 2025
Merged
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 adds a new
onAfterDevCompileplugin hook to replace the previousonDevCompileDonehook.The intention of this change is to keep the naming of dev compile related hooks consistent, refer to #5788 (review)
The previous
onDevCompileDonehook is still usable. I will explain the relationship between the two in the documentation after v1.5.0 is released.Checklist