diff --git a/packages/vant-cli/src/compiler/compile-site.ts b/packages/vant-cli/src/compiler/compile-site.ts index d023c7e0c..1c93b2703 100644 --- a/packages/vant-cli/src/compiler/compile-site.ts +++ b/packages/vant-cli/src/compiler/compile-site.ts @@ -21,10 +21,13 @@ function runDevServer( port: number, config: ReturnType ) { - const server = new WebpackDevServer(webpack(config), config.devServer); + const server = new WebpackDevServer(webpack(config), { + ...config.devServer, + port, + }); // this is a hack to disable wds status log - (server as any).showStatus = function() {}; + (server as any).showStatus = function () {}; const host = get(config.devServer, 'host', 'localhost'); server.listen(port, host, (err?: Error) => {