fix(config/types): defineConfig should support asyncFn#3000
Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Rsdoctor Bundle Diff AnalysisFound 3 projects in monorepo, 2 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 nodePath:
📦 Download Diff Report: node Bundle Diff 📁 webPath:
📦 Download Diff Report: web Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
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
defineConfigfunction with support for async functions returningPromise<UserConfig> - Relocated
loadConfigFilefromcli/configtoconfigdirectory 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.
45837fd to
9ea3eba
Compare
|
Twoslash introduces JSDocs, which causes the bundle size to grow. |
Summary
fix(config/types): defineConfig should support asyncFn
Related Issue
Checklist