Skip to content

refactor!: lazy compilation middleware supports multiCompiler and use config from compiler instance #9828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Mar 28, 2025

Summary

Lazy compilation middleware can receive multiCompiler as parameter

When there is a module triggers update, we notify the multiWatching, then multiWatching will invalidate its sub watching.

Every compiler can has its own lazy-compilation config, for example you can make compiler_1 only lazy compiles entries, while compiler_2 only lazy compiles imports

Checklist

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

@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Mar 28, 2025
Copy link

netlify bot commented Mar 28, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit ade0661
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/682a2aa49dde3b0008c08ef3

Copy link

codspeed-hq bot commented Mar 28, 2025

CodSpeed Performance Report

Merging #9828 will not alter performance

Comparing feat/lazy-compilation-multi-compiler (ade0661) with main (edf4038)

Summary

✅ 11 untouched benchmarks

@JSerFeng JSerFeng force-pushed the feat/lazy-compilation-multi-compiler branch from 241fc39 to 578a468 Compare March 28, 2025 10:03
@chenjiahan
Copy link
Member

@JSerFeng Can we fix the CI and get this PR merged? ❤️

@JSerFeng JSerFeng force-pushed the feat/lazy-compilation-multi-compiler branch 5 times, most recently from 0d9ba83 to 612de05 Compare May 8, 2025 11:19
@JSerFeng JSerFeng requested a review from Copilot May 9, 2025 04:10
Copy link
Contributor

@Copilot 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 adds support for passing a MultiCompiler to the lazy compilation middleware, enabling per-compiler lazy compilation configurations and introducing new hooks in MultiCompiler.

  • Updated middleware to handle both Compiler and MultiCompiler instances.
  • Added new hooks (beforeCompile, shutdown) and corresponding API updates.
  • Enhanced tests to cover multiCompiler lazy compilation scenarios.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/rspack/src/builtin-plugin/lazy-compilation/middleware.ts Updated middleware to accept MultiCompiler and process each compiler.
packages/rspack/src/MultiWatching.ts Introduced invalidateWithChangesAndRemovals for multi watching.
packages/rspack/src/MultiCompiler.ts Added new hooks and watching property to MultiCompiler.
packages/rspack/etc/core.api.md Updated API definitions to reflect new MultiCompiler support.
packages/rspack-test-tools/tests/legacy-test/MultiCompiler.test.js Added tests for multi-compiler lazy compilation.
packages/rspack-test-tools/src/plugin/lazy-compilation-test-plugin.ts Modified plugin to support MultiCompiler parameter.
packages/rspack-cli/src/commands/serve.ts Modified serve command to use lazy compilation middleware with MultiCompiler.
Others Minor updates to test fixtures and API documentation.

@JSerFeng JSerFeng force-pushed the feat/lazy-compilation-multi-compiler branch 4 times, most recently from 6dc6454 to 8304647 Compare May 12, 2025 06:12
@JSerFeng JSerFeng enabled auto-merge (squash) May 12, 2025 06:50
@JSerFeng JSerFeng force-pushed the feat/lazy-compilation-multi-compiler branch from 8304647 to 5ff046f Compare May 18, 2025 18:36
@JSerFeng JSerFeng force-pushed the feat/lazy-compilation-multi-compiler branch from 5ff046f to ade0661 Compare May 18, 2025 18:44
@JSerFeng JSerFeng changed the title feat: lazy compilation middleware supports multiCompiler refactor: lazy compilation middleware supports multiCompiler and use config from compiler instance May 18, 2025
@JSerFeng JSerFeng changed the title refactor: lazy compilation middleware supports multiCompiler and use config from compiler instance !refactor: lazy compilation middleware supports multiCompiler and use config from compiler instance May 18, 2025
@github-actions github-actions bot removed the release: feature release: feature related release(mr only) label May 18, 2025
@JSerFeng JSerFeng changed the title !refactor: lazy compilation middleware supports multiCompiler and use config from compiler instance refactor!: lazy compilation middleware supports multiCompiler and use config from compiler instance May 18, 2025
@chenjiahan chenjiahan added this to the 1.4.0 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants