Skip to content
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

chore(server): add compiler option for createDevServer #6287

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading