From 330772053b4508d547d497f530677a9732bcde3e Mon Sep 17 00:00:00 2001 From: Sam Tsai Date: Wed, 16 Oct 2024 05:33:52 -0400 Subject: [PATCH] fix(rspack): make rspack dev server respect port (#28251) ## Current Behavior Port is not respected from `rspack.config.[jt]s` and needs to be explicitly set in `project.json` options. ## Expected Behavior Port should be configurable via config, options, etc. ## Related Issue(s) Fixes #28040 (port portion) --- packages/rspack/src/executors/dev-server/dev-server.impl.ts | 3 +-- .../rspack/src/utils/resolve-user-defined-rspack-config.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/rspack/src/executors/dev-server/dev-server.impl.ts b/packages/rspack/src/executors/dev-server/dev-server.impl.ts index 2f1f1925b0bca..560dd54ff7dfe 100644 --- a/packages/rspack/src/executors/dev-server/dev-server.impl.ts +++ b/packages/rspack/src/executors/dev-server/dev-server.impl.ts @@ -49,10 +49,9 @@ export default async function* runExecutor( devServerConfig = { ...devServerConfig, ...firstCompiler.options.devServer, - port: devServerConfig.port, }; - const baseUrl = `http://localhost:${options.port ?? 4200}`; + const baseUrl = `http://localhost:${devServerConfig.port ?? 4200}`; return yield* createAsyncIterable(({ next }) => { const server = new RspackDevServer( diff --git a/packages/rspack/src/utils/resolve-user-defined-rspack-config.ts b/packages/rspack/src/utils/resolve-user-defined-rspack-config.ts index e4145d9280d89..24c612296a9ec 100644 --- a/packages/rspack/src/utils/resolve-user-defined-rspack-config.ts +++ b/packages/rspack/src/utils/resolve-user-defined-rspack-config.ts @@ -27,7 +27,7 @@ export function resolveUserDefinedRspackConfig( cleanupTranspiler(); // If the user provides a configuration in TS file - // then there are 3 cases for exporing an object. The first one is: + // then there are 3 cases for exploring an object. The first one is: // `module.exports = { ... }`. And the second one is: // `export default { ... }`. The ESM format is compiled into: // `{ default: { ... } }`