Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

This PR adjusts the calling timing of compiler.watch(). We need to register lazyCompilationMiddleware first, and then call compiler.watch() to ensure that lazy compilation can take effect.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings June 23, 2025 07:19
@netlify
Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 9b2e9f3
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/685902c3f4fc6c000827c525
😎 Deploy Preview https://deploy-preview-5469--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 78 (🟢 up 3 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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

Copy link
Contributor

Copilot AI left a comment

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 ensures that lazy compilation middleware is registered before kicking off the compiler’s watch process, updates the middleware API, bumps the middleware version, and re-enables related E2E tests.

  • Register lazyCompilationMiddleware before invoking compiler.watch()
  • Expose a new watch() method on CompilationMiddleware and CompilationManager
  • Bump rsbuild-dev-middleware to v0.3.0 and unskip relevant lazy-compilation tests

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/server/devServer.ts Added compilationManager?.watch() call after middleware registration
packages/core/src/server/compilationMiddleware.ts Extended CompilationMiddleware interface to declare a watch() method
packages/core/src/server/compilationManager.ts Added public watch() that delegates to middleware and wired wrapper.watch
packages/core/package.json Bumped rsbuild-dev-middleware dependency from 0.2.0 to 0.3.0
e2e/cases/lazy-compilation/* Unskipped E2E tests for lazy compilation and updated a placeholder TODO comment in one case
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (4)

e2e/cases/lazy-compilation/port-placeholder/index.test.ts:4

  • [nitpick] The TODO comment is too generic; please update it to explain why this test is skipped and reference the related issue for context.
// TODO: fixme

packages/core/src/server/compilationManager.ts:124

  • The JSDoc for watch says it calls compiler.watch(), but it actually delegates to middleware.watch(). Please update the comment to accurately describe the delegation.
  /**

packages/core/src/server/compilationManager.ts:127

  • Consider adding a unit test for the new watch method to verify that it correctly calls middleware.watch() and starts compilation as expected.
  public watch(): void {

packages/core/src/server/devServer.ts:471

  • Using optional chaining here will silently skip starting the watcher if compilationManager is undefined. If compilationManager should always be present, consider removing ? or adding an explicit check to avoid silent failures.
  compilationManager?.watch();

@chenjiahan chenjiahan merged commit 3975d5d into main Jun 23, 2025
11 checks passed
@chenjiahan chenjiahan deleted the middleware_order_0623 branch June 23, 2025 07:38
This was referenced Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Lazy compilation not work with playwright >= 1.43.0

1 participant