Skip to content

fix(config/types): defineConfig should support asyncFn#3000

Merged
SoonIter merged 4 commits intomainfrom
syt/fix-config-async
Jan 13, 2026
Merged

fix(config/types): defineConfig should support asyncFn#3000
SoonIter merged 4 commits intomainfrom
syt/fix-config-async

Conversation

@SoonIter
Copy link
Copy Markdown
Member

Summary

fix(config/types): defineConfig should support asyncFn

Related Issue

Checklist

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

Copilot AI review requested due to automatic review settings January 13, 2026 04:00
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 13, 2026

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit b2bd51d
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/6965d3b01ab999000882ed2b
😎 Deploy Preview https://deploy-preview-3000--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 13, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 2 projects with changes.

📊 Quick Summary
Project Total Size Change
node 10.0 MB +58.3 KB (0.6%)
node_md 1.3 MB 0
web 15.7 MB +47.1 KB (0.3%)
📋 Detailed Reports (Click to expand)

📁 node

Path: website/doc_build/diff-rsdoctor/node/rsdoctor-data.json

📌 Baseline Commit: d72b080532 | PR: #2998

Metric Current Baseline Change
📊 Total Size 10.0 MB 9.9 MB +58.3 KB (0.6%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 10.0 MB 9.9 MB +58.3 KB (0.6%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: node Bundle Diff

📁 web

Path: website/doc_build/diff-rsdoctor/web/rsdoctor-data.json

📌 Baseline Commit: d72b080532 | PR: #2998

Metric Current Baseline Change
📊 Total Size 15.7 MB 15.7 MB +47.1 KB (0.3%)
📄 JavaScript 15.0 MB 15.0 MB +47.1 KB (0.3%)
🎨 CSS 126.3 KB 126.3 KB 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 584.1 KB 584.1 KB 0

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

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 pull request enhances the defineConfig function to support asynchronous configuration functions, addressing a limitation where users couldn't perform async operations (like dynamically allocating ports) in their configuration files. The implementation relocates defineConfig from cli/config to a new dedicated config directory and updates the type signature to handle both synchronous and asynchronous config definitions.

Changes:

  • Introduced overloaded defineConfig function with support for async functions returning Promise<UserConfig>
  • Relocated loadConfigFile from cli/config to config directory for better organization
  • Updated two e2e fixture configurations to demonstrate async config usage with dynamic port allocation

Reviewed changes

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

Show a summary per file
File Description
packages/core/src/config/defineConfig.ts New implementation with overloaded signatures supporting both sync and async configs
packages/core/src/config/loadConfigFile.ts Moved from cli/config, delegates to @rsbuild/core's loadConfig which handles async configs
packages/core/src/index.ts Updated export path from ./cli/config to ./config/defineConfig
packages/core/src/cli/index.ts Updated import path to reference new config location
packages/core/src/cli/config/index.ts Removed old defineConfig implementation
e2e/fixtures/plugin-preview/rspress.config.ts Demonstrates async config usage with dynamic port allocation
e2e/fixtures/plugin-preview-custom-entry/rspress.config.ts Demonstrates async config usage with dynamic port allocation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Timeless0911
Timeless0911 previously approved these changes Jan 13, 2026
@SoonIter SoonIter force-pushed the syt/fix-config-async branch from 45837fd to 9ea3eba Compare January 13, 2026 04:16
@SoonIter
Copy link
Copy Markdown
Member Author

Twoslash introduces JSDocs, which causes the bundle size to grow.

@SoonIter SoonIter enabled auto-merge (squash) January 13, 2026 05:35
@SoonIter SoonIter merged commit 1072a57 into main Jan 13, 2026
8 checks passed
@SoonIter SoonIter deleted the syt/fix-config-async branch January 13, 2026 05:35
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.

3 participants