fix(nuxi): respect NUXT_PORT and NUXT_HOST vars in dev mode (#3973)

This commit is contained in:
Daniel Roe 2022-03-30 20:07:26 +01:00 committed by GitHub
parent 1a39eff502
commit df188d7734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,8 @@ Option | Default | Description
`--ssl-cert` |`null` | Specify a certificate for https.
`--ssl-key` |`null` | Specify the key for the https certificate.
The port and host can also be set via NUXT_PORT, PORT, NUXT_HOST or HOST environment variables.
This command sets `process.env.NODE_ENV` to `development`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
## Build

View File

@ -23,8 +23,8 @@ export default defineNuxtCommand({
const listener = await server.listen({
clipboard: args.clipboard,
open: args.open || args.o,
port: args.port || args.p,
hostname: args.host || args.h,
port: args.port || args.p || process.env.NUXT_PORT,
hostname: args.host || args.h || process.env.NUXT_HOST,
https: Boolean(args.https),
certificate: (args['ssl-cert'] && args['ssl-key']) && {
cert: args['ssl-cert'],