Skip to content

Conversation

@JSerFeng
Copy link
Contributor

@JSerFeng JSerFeng commented Feb 28, 2025

Summary

Introduce LazyCompilationMiddleware, which is used to support handle requests sent by lazy-compilation.

Breaking change

There is no extra server for LazyCompilation, extra server has following issues:

  1. Extra server cannot share the same proxy config with devServer
  2. Hard to make CORS right, which has potential secure issue

In order to solve above issues, we move the logic inside previous lazy compilation server backend to a standalong middleware which can be used by any custom server.

eg.

import { experiments, rspack } from '@rspack/core'
import config from './rspack.config'
import { app } from './server'

const compiler = rspack(config)
if (config.experiments.lazyCompilation) {
  const middleware = experiments.lazyCompilation(compiler)
  app.use(middleware)
}

Even if your server does not support express style middleware, you can create a simple wrapper yourself, just to make sure you satisfy its interface

Checklist

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

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Feb 28, 2025
@netlify
Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 6ad32ee
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67e23d4ca298de00084c2b09

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 28, 2025

CodSpeed Performance Report

Merging #9515 will not alter performance

Comparing refactor/lazy-compilation (6ad32ee) with main (9659d18)

Summary

✅ 8 untouched benchmarks

@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch 9 times, most recently from e1a6132 to 14c4bf9 Compare March 4, 2025 05:22
@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch 8 times, most recently from ae3ff58 to 19edf61 Compare March 11, 2025 05:56
@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch 5 times, most recently from df3bad4 to 2a44846 Compare March 19, 2025 08:48
@JSerFeng JSerFeng requested a review from chenjiahan March 19, 2025 10:19
@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch 2 times, most recently from 4071a13 to ae343e3 Compare March 21, 2025 09:05
@chenjiahan chenjiahan changed the title refactor: introduce lazycompilation-middleware feat: introduce lazy compilation middleware Mar 23, 2025
@github-actions github-actions bot added the release: feature release: feature related release(mr only) label Mar 23, 2025
@chenjiahan chenjiahan changed the title feat: introduce lazy compilation middleware feat!: introduce lazy compilation middleware Mar 23, 2025
chenjiahan

This comment was marked as resolved.

JSerFeng and others added 11 commits March 24, 2025 18:35
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch 2 times, most recently from b1aabb5 to ff6e61e Compare March 25, 2025 04:31
@JSerFeng JSerFeng force-pushed the refactor/lazy-compilation branch from ff6e61e to 6ad32ee Compare March 25, 2025 05:21
@JSerFeng JSerFeng marked this pull request as ready for review March 25, 2025 06:12
@JSerFeng JSerFeng enabled auto-merge (squash) March 25, 2025 06:26
@JSerFeng JSerFeng merged commit fd080d9 into main Mar 25, 2025
31 checks passed
@JSerFeng JSerFeng deleted the refactor/lazy-compilation branch March 25, 2025 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants