Skip to content

Commit

Permalink
fix(rspack): make rspack dev server respect port (#28251)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
Port is not respected from `rspack.config.[jt]s` and needs to be
explicitly set in `project.json` options.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Port should be configurable via config, options, etc.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes #28040 (port portion)
  • Loading branch information
samtsai authored Oct 16, 2024
1 parent 200b62a commit 3307720
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/rspack/src/executors/dev-server/dev-server.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: { ... } }`
Expand Down

0 comments on commit 3307720

Please sign in to comment.