mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxi): read devServer
options from nuxt config (#19055)
This commit is contained in:
parent
681cfa83fd
commit
c45b842037
@ -44,20 +44,27 @@ export default defineNuxtCommand({
|
||||
|
||||
await setupDotenv({ cwd: rootDir, fileName: args.dotenv })
|
||||
|
||||
const { loadNuxt, loadNuxtConfig, buildNuxt } = await loadKit(rootDir)
|
||||
|
||||
const config = await loadNuxtConfig({
|
||||
cwd: rootDir,
|
||||
overrides: { dev: true }
|
||||
})
|
||||
|
||||
const listener = await listen(serverHandler, {
|
||||
showURL: false,
|
||||
clipboard: args.clipboard,
|
||||
open: args.open || args.o,
|
||||
port: args.port || args.p || process.env.NUXT_PORT,
|
||||
hostname: args.host || args.h || process.env.NUXT_HOST,
|
||||
https: args.https && {
|
||||
cert: args['ssl-cert'],
|
||||
key: args['ssl-key']
|
||||
}
|
||||
port: args.port || args.p || process.env.NUXT_PORT || config.devServer.port,
|
||||
hostname: args.host || args.h || process.env.NUXT_HOST || config.devServer.host,
|
||||
https: (args.https !== false && (args.https || config.devServer.https))
|
||||
? {
|
||||
cert: args['ssl-cert'] || (config.devServer.https && config.devServer.https.cert) || undefined,
|
||||
key: args['ssl-key'] || (config.devServer.https && config.devServer.https.key) || undefined
|
||||
}
|
||||
: false
|
||||
})
|
||||
|
||||
const { loadNuxt, buildNuxt } = await loadKit(rootDir)
|
||||
|
||||
let currentNuxt: Nuxt
|
||||
const showURL = () => {
|
||||
listener.showURL({
|
||||
|
@ -28,10 +28,13 @@ export default defineUntypedSchema({
|
||||
port: process.env.NUXT_PORT || process.env.NITRO_PORT || process.env.PORT || 3000,
|
||||
|
||||
/** Dev server listening host */
|
||||
host: process.env.NUXT_HOST || process.env.NITRO_HOST || process.env.HOST || 'localhost',
|
||||
host: process.env.NUXT_HOST || process.env.NITRO_HOST || process.env.HOST || '',
|
||||
|
||||
/**
|
||||
* Listening dev server url
|
||||
* Listening dev server URL.
|
||||
*
|
||||
* This should not be set directly as it will always be overridden by the
|
||||
* dev server with the full URL (for module and internal use).
|
||||
*/
|
||||
url: 'http://localhost:3000',
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user