Skip to content

perf(dev-server): make asset middleware file lookup async - #6295

Merged
chenjiahan merged 1 commit into
mainfrom
stat_async_1001
Oct 1, 2025
Merged

perf(dev-server): make asset middleware file lookup async#6295
chenjiahan merged 1 commit into
mainfrom
stat_async_1001

Conversation

@chenjiahan

@chenjiahan chenjiahan commented Oct 1, 2025

Copy link
Copy Markdown
Member

Summary

  • use async stats from Rspack output fs to avoid sync bottlenecks
  • simplify OutputFileSystem typing

Checklist

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

Copilot AI review requested due to automatic review settings October 1, 2025 09:32
@netlify

netlify Bot commented Oct 1, 2025

Copy link
Copy Markdown

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit bc2eb61
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68dcf5456606ef000826b1a0
😎 Deploy Preview https://deploy-preview-6295--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: 45 (🔴 down 25 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.

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 optimizes the asset middleware by converting synchronous file system operations to asynchronous ones to avoid blocking the event loop. The main goal is to improve performance by using async stats from Rspack's output filesystem instead of sync bottlenecks.

Key changes:

  • Convert getFileFromUrl function from synchronous to asynchronous
  • Update OutputFileSystem type definition to use Rspack's native types
  • Update all callers to properly await the async file lookups

Reviewed Changes

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

File Description
packages/core/src/server/assets-middleware/getFileFromUrl.ts Convert to async function with Promise-based file stat operations
packages/core/src/server/assets-middleware/middleware.ts Update caller to await the async getFileFromUrl function
packages/core/src/server/browserLogs.ts Update caller to await the async getFileFromUrl function
packages/core/src/server/assets-middleware/index.ts Update OutputFileSystem type to use Rspack's native types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/core/src/server/assets-middleware/getFileFromUrl.ts
@chenjiahan
chenjiahan merged commit f04875d into main Oct 1, 2025
23 of 25 checks passed
@chenjiahan
chenjiahan deleted the stat_async_1001 branch October 1, 2025 12:42
@chenjiahan chenjiahan mentioned this pull request Oct 8, 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.

2 participants