diff --git a/.changeset/great-trains-run.md b/.changeset/great-trains-run.md new file mode 100644 index 000000000000..dcbde755bd02 --- /dev/null +++ b/.changeset/great-trains-run.md @@ -0,0 +1,6 @@ +--- +'@modern-js/server': patch +--- + +chore(server): add `compiler` option for `createDevServer` +chore(server): 为 `createDevServer` 添加 `compiler` 选项 diff --git a/packages/server/server/src/createDevServer.ts b/packages/server/server/src/createDevServer.ts index 1c62e3b5e07e..f9755a7f630d 100644 --- a/packages/server/server/src/createDevServer.ts +++ b/packages/server/server/src/createDevServer.ts @@ -49,6 +49,7 @@ export async function createDevServer( const builderDevServer = await builder?.createDevServer({ runCompile: options.runCompile, + compiler: options.compilier, }); server.addPlugins([ diff --git a/packages/server/server/src/types.ts b/packages/server/server/src/types.ts index 42473581a421..00277f4180f9 100644 --- a/packages/server/server/src/types.ts +++ b/packages/server/server/src/types.ts @@ -1,5 +1,5 @@ import type { DevServerHttpsOptions, DevServerOptions } from '@modern-js/types'; -import type { UniBuilderInstance } from '@modern-js/uni-builder'; +import type { Rspack, UniBuilderInstance } from '@modern-js/uni-builder'; import type { NodeServer, @@ -17,6 +17,11 @@ export type ExtraOptions = { runCompile?: boolean; + /** + * The existing compiler can be used here. + */ + compilier?: Rspack.Compiler | Rspack.MultiCompiler; + /** compat, the default value is modern.server-runtime.config.ts */ serverConfigFile?: string;