Skip to content

Commit

Permalink
fix: allow overriding internal dev server error via _PORT (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 11, 2023
1 parent 9358f6c commit cf0fe6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/commands/dev-child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default defineCommand({
clear: !!ctx.args.clear,
dotenv: !!ctx.args.dotenv,
https: devProxyOptions.https,
port: process.env._PORT ?? undefined,
})

// IPC Hooks
Expand Down
3 changes: 2 additions & 1 deletion src/utils/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ export interface NuxtDevServerOptions {
clear: boolean
overrides: NuxtConfig
https?: boolean | HTTPSOptions
port?: string | number
loadingTemplate?: ({ loading }: { loading: string }) => string
}

export async function createNuxtDevServer(options: NuxtDevServerOptions) {
const devServer = new NuxtDevServer(options)
devServer.listener = await listen(devServer.handler, {
port: 0,
port: options.port ?? 0,
hostname: '127.0.0.1',
showURL: false,
})
Expand Down

0 comments on commit cf0fe6d

Please sign in to comment.