Skip to content

Commit

Permalink
chore(server): add compiler option for createDevServer (web-infra-dev…
Browse files Browse the repository at this point in the history
  • Loading branch information
await-ovo authored Sep 29, 2024
1 parent 73603ef commit 552b746
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/great-trains-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modern-js/server': patch
---

chore(server): add `compiler` option for `createDevServer`
chore(server): 为 `createDevServer` 添加 `compiler` 选项
1 change: 1 addition & 0 deletions packages/server/server/src/createDevServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export async function createDevServer(

const builderDevServer = await builder?.createDevServer({
runCompile: options.runCompile,
compiler: options.compilier,
});

server.addPlugins([
Expand Down
7 changes: 6 additions & 1 deletion packages/server/server/src/types.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;

Expand Down

0 comments on commit 552b746

Please sign in to comment.