Skip to content

Commit

Permalink
fix: pages default local port regression (#5536)
Browse files Browse the repository at this point in the history
fix(wrangler): fix `pages dev` default port

#5284 changed
the default port used by `wrangler pages dev` from `8788` to
`8787`. Unfortunately this is a regression, as some folks rely on
the previous port number.

This commit reverts the change, and sets the default port back to
`8788`.
  • Loading branch information
Cherry authored Apr 9, 2024
1 parent dcd65dd commit a7aa28a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-bikes-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: resolve a regression where `wrangler pages dev` would bind to port 8787 by default instead of 8788 since wrangler@3.38.0
4 changes: 2 additions & 2 deletions packages/wrangler/src/pages/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { existsSync, lstatSync, readFileSync } from "node:fs";
import { join, resolve } from "node:path";
import { watch } from "chokidar";
import * as esbuild from "esbuild";
import { DEFAULT_LOCAL_PORT } from "..";
import { unstable_dev } from "../api";
import { readConfig } from "../config";
import { isBuildFailure } from "../deployment-bundle/build-failures";
Expand Down Expand Up @@ -77,6 +76,7 @@ const SERVICE_BINDING_REGEXP = new RegExp(
);

const DEFAULT_IP = process.platform === "win32" ? "127.0.0.1" : "localhost";
const DEFAULT_PAGES_LOCAL_PORT = 8788;
const DEFAULT_SCRIPT_PATH = "_worker.js";

export function Options(yargs: CommonYargsArgv) {
Expand Down Expand Up @@ -862,7 +862,7 @@ function resolvePagesDevServerSettings(
compatibilityFlags: args.compatibilityFlags ?? config.compatibility_flags,
ip: args.ip ?? config.dev.ip ?? DEFAULT_IP,
// because otherwise `unstable_dev` will default the port number to `0`
port: args.port ?? config.dev?.port ?? DEFAULT_LOCAL_PORT,
port: args.port ?? config.dev?.port ?? DEFAULT_PAGES_LOCAL_PORT,
inspectorPort: args.inspectorPort ?? config.dev?.inspector_port,
localProtocol: args.localProtocol ?? config.dev?.local_protocol,
};
Expand Down

0 comments on commit a7aa28a

Please sign in to comment.