From 0b45721b8e61800882b127c85a2dd6e40929f05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levi=20=28Nguy=E1=BB=85n=20L=C6=B0=C6=A1ng=20Huy=29?= Date: Thu, 14 Oct 2021 18:36:04 +0700 Subject: [PATCH] feat(nuxi): support `--host`, `--ssl-cert`, and `--ssl-key` args (#993) --- packages/nuxi/src/commands/dev.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/nuxi/src/commands/dev.ts b/packages/nuxi/src/commands/dev.ts index 00819598d0..d4cdfb8f1a 100644 --- a/packages/nuxi/src/commands/dev.ts +++ b/packages/nuxi/src/commands/dev.ts @@ -12,16 +12,25 @@ import { defineNuxtCommand } from './index' export default defineNuxtCommand({ meta: { name: 'dev', - usage: 'npx nuxi dev [rootDir] [--clipboard] [--open, -o]', + usage: 'npx nuxi dev [rootDir] [--clipboard] [--open, -o] [--port, -p] [--host, -h] [--ssl-cert] [--ssl-key]', description: 'Run nuxt development server' }, async invoke (args) { process.env.NODE_ENV = process.env.NODE_ENV || 'development' + const https = !!(args['ssl-cert'] && args['ssl-key']) const server = createServer() const listener = await server.listen({ clipboard: args.clipboard, open: args.open || args.o, - port: args.port || args.p + port: args.port || args.p, + hostname: args.host || args.h, + ...(https && { + https, + certificate: { + cert: args['ssl-cert'], + key: args['ssl-key'] + } + }) }) const rootDir = resolve(args._[0] || '.')