Skip to content

perf: use dynamic imports for readline#5308

Merged
chenjiahan merged 1 commit intomainfrom
readline_dymamic_0526
May 26, 2025
Merged

perf: use dynamic imports for readline#5308
chenjiahan merged 1 commit intomainfrom
readline_dymamic_0526

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

Dynamically importing the node:readline module for performance.

Checklist

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

Copilot AI review requested due to automatic review settings May 26, 2025 07:07
Copy link
Copy Markdown
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 aims to improve performance by converting the synchronous import of the node:readline module to a dynamic (asynchronous) import. Key changes include:

  • Wrapping the cliShortcuts setup in an async-await pattern in both production and development servers.
  • Updating the signature of setupCliShortcuts to return a Promise.
  • Using dynamic import to load the node:readline module when needed.

Reviewed Changes

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

File Description
packages/core/src/server/prodServer.ts Awaits setupCliShortcuts to align with the new asynchronous API usage.
packages/core/src/server/devServer.ts Adjusts beforeCreateCompiler and its calls to await the asynchronous setup.
packages/core/src/server/cliShortcuts.ts Updates cliShortcuts function to use dynamic import for node:readline.

@netlify
Copy link
Copy Markdown

netlify bot commented May 26, 2025

Deploy Preview for rsbuild failed. Why did it fail? →

Name Link
🔨 Latest commit 861651c
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68341326aa4a220008a91d72

@chenjiahan chenjiahan merged commit 99c5a22 into main May 26, 2025
9 of 30 checks passed
@chenjiahan chenjiahan deleted the readline_dymamic_0526 branch May 26, 2025 07:34
@chenjiahan chenjiahan mentioned this pull request May 27, 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