-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Core: Add experimental_devServer preset
#32862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,7 +225,7 @@ export type Middleware<T extends IncomingMessage = IncomingMessage> = ( | |
| next: (err?: string | Error) => Promise<void> | void | ||
| ) => Promise<void> | void; | ||
|
|
||
| interface ServerApp<T extends IncomingMessage = IncomingMessage> { | ||
| export interface ServerApp<T extends IncomingMessage = IncomingMessage> { | ||
| server: NetServer; | ||
|
|
||
| use(pattern: RegExp | string, ...handlers: Middleware<T>[]): this; | ||
|
|
@@ -480,6 +480,8 @@ export interface StorybookConfigRaw { | |
|
|
||
| experimental_indexers?: Indexer[]; | ||
|
|
||
| experimental_devServer?: ServerApp; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect type definition for experimental_devServer. The type is defined as experimental_devServer: async (app) => {
app.use('/my-custom-route', ...);
return app;
}Apply this diff to fix the type: - experimental_devServer?: ServerApp;
+ experimental_devServer?: (app: ServerApp) => ServerApp | Promise<ServerApp>;🤖 Prompt for AI Agents |
||
|
|
||
| docs?: DocsOptions; | ||
|
|
||
| previewHead?: string; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type mismatch and missing return value capture.
Based on the PR objectives,
experimental_devServershould be an async function that receives the app and returns it (e.g.,async (app) => { app.use(...); return app; }). However, the type definition incore-common.tsline 483 defines it asexperimental_devServer?: ServerApp, not as a function type. Additionally, the return value from the preset application is not captured, which means if a preset returns a modified app instance, it will be lost.Apply this diff to capture the return value:
Additionally, update the type definition in
core-common.tsto reflect that this should be a function:🤖 Prompt for AI Agents