diff --git a/docs/config/index.md b/docs/config/index.md index 49b7cdc9790667..d4d23b676d3b06 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -845,7 +845,7 @@ export default defineConfig({ ### preview.port - **Type:** `number` -- **Default:** `5000` +- **Default:** `4173` Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. diff --git a/packages/vite/src/node/preview.ts b/packages/vite/src/node/preview.ts index 7a6f00c7d843f8..5f4fe480c4f90f 100644 --- a/packages/vite/src/node/preview.ts +++ b/packages/vite/src/node/preview.ts @@ -96,7 +96,7 @@ export async function preview( const options = config.preview const hostname = resolveHostname(options.host) - const port = options.port ?? 5000 + const port = options.port ?? 4173 const protocol = options.https ? 'https' : 'http' const logger = config.logger const base = config.base diff --git a/scripts/jestPerTestSetup.ts b/scripts/jestPerTestSetup.ts index cf4f96e87e7a54..89209c3ffcbf69 100644 --- a/scripts/jestPerTestSetup.ts +++ b/scripts/jestPerTestSetup.ts @@ -194,7 +194,7 @@ function startStaticServer(): Promise { serve(req, res) } })) - let port = 5000 + let port = 4173 return new Promise((resolve, reject) => { const onError = (e: any) => { if (e.code === 'EADDRINUSE') {