From 20ef73a182d4502bdc8d023c444b8bd5a0a54c00 Mon Sep 17 00:00:00 2001 From: await-ovo Date: Fri, 27 Sep 2024 16:23:15 +0800 Subject: [PATCH 1/2] chore(server): add compiler option for createDevServer chore: update changeset --- .changeset/great-trains-run.md | 5 +++++ packages/server/server/src/createDevServer.ts | 1 + packages/server/server/src/types.ts | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/great-trains-run.md diff --git a/.changeset/great-trains-run.md b/.changeset/great-trains-run.md new file mode 100644 index 000000000000..ee5ee857ebf1 --- /dev/null +++ b/.changeset/great-trains-run.md @@ -0,0 +1,5 @@ +--- +'@modern-js/server': patch +--- + +chore(server): add compiler option for `createDevServer`. 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; From b14cd483774e778aaac2dd648e7268aa272993fe Mon Sep 17 00:00:00 2001 From: await-ovo Date: Fri, 27 Sep 2024 16:32:34 +0800 Subject: [PATCH 2/2] chore: update changeset --- .changeset/great-trains-run.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changeset/great-trains-run.md b/.changeset/great-trains-run.md index ee5ee857ebf1..dcbde755bd02 100644 --- a/.changeset/great-trains-run.md +++ b/.changeset/great-trains-run.md @@ -2,4 +2,5 @@ '@modern-js/server': patch --- -chore(server): add compiler option for `createDevServer`. +chore(server): add `compiler` option for `createDevServer` +chore(server): 为 `createDevServer` 添加 `compiler` 选项