mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +00:00
Update commands
This commit is contained in:
parent
4d6b85cfdd
commit
bbf6ea2953
@ -13,6 +13,7 @@ const { resolve } = require('path')
|
||||
|
||||
const rootDir = resolve(process.argv.slice(2)[0] || '.')
|
||||
const nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')
|
||||
|
||||
let options = {}
|
||||
if (fs.existsSync(nuxtConfigFile)) {
|
||||
options = require(nuxtConfigFile)
|
||||
@ -20,11 +21,11 @@ if (fs.existsSync(nuxtConfigFile)) {
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
||||
options.dev = true // Add hot reloading and watching changes
|
||||
|
||||
new Nuxt(options)
|
||||
.then((nuxt) => {
|
||||
const nuxt = new Nuxt(options)
|
||||
nuxt.build()
|
||||
.then(() => {
|
||||
const server = new Server(nuxt)
|
||||
.listen(process.env.PORT || process.env.npm_package_config_nuxt_port, process.env.HOST || process.env.npm_package_config_nuxt_host)
|
||||
listenOnConfigChanges(nuxt, server)
|
||||
@ -46,7 +47,7 @@ function listenOnConfigChanges (nuxt, server) {
|
||||
options.rootDir = rootDir
|
||||
nuxt.close()
|
||||
.then(() => {
|
||||
return new Nuxt(options)
|
||||
return new Nuxt(options).build()
|
||||
})
|
||||
.then((nuxt) => {
|
||||
server.nuxt = nuxt
|
||||
|
@ -9,6 +9,7 @@ const { resolve } = require('path')
|
||||
|
||||
const rootDir = resolve(process.argv.slice(2)[0] || '.')
|
||||
const nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')
|
||||
|
||||
let options = {}
|
||||
if (fs.existsSync(nuxtConfigFile)) {
|
||||
options = require(nuxtConfigFile)
|
||||
@ -16,14 +17,11 @@ if (fs.existsSync(nuxtConfigFile)) {
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
||||
options._build = false // nuxt.generate() will call nuxt.build() itself
|
||||
options._renderer = false // let nuxt.generate() create the vue renderer
|
||||
options.dev = false // Force production mode (no webpack middlewares called)
|
||||
|
||||
console.log('[nuxt] Generating...')
|
||||
new Nuxt(options)
|
||||
.then((nuxt) => nuxt.generate())
|
||||
const nuxt = new Nuxt(options)
|
||||
nuxt.generate()
|
||||
.then(() => {
|
||||
console.log('[nuxt] Generate done')
|
||||
})
|
||||
|
@ -7,6 +7,7 @@ const { resolve } = require('path')
|
||||
|
||||
const rootDir = resolve(process.argv.slice(2)[0] || '.')
|
||||
const nuxtConfigFile = resolve(rootDir, 'nuxt.config.js')
|
||||
|
||||
let options = {}
|
||||
if (fs.existsSync(nuxtConfigFile)) {
|
||||
options = require(nuxtConfigFile)
|
||||
@ -14,16 +15,12 @@ if (fs.existsSync(nuxtConfigFile)) {
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
||||
options._build = false // Disable building
|
||||
options.dev = false // Force production mode (no webpack middlewares called)
|
||||
|
||||
new Nuxt(options)
|
||||
.then((nuxt) => {
|
||||
new Server(nuxt)
|
||||
.listen(process.env.PORT || process.env.npm_package_config_nuxt_port, process.env.HOST || process.env.npm_package_config_nuxt_host)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
const nuxt = new Nuxt(options)
|
||||
|
||||
new Server(nuxt)
|
||||
.listen(
|
||||
process.env.PORT || process.env.npm_package_config_nuxt_port,
|
||||
process.env.HOST || process.env.npm_package_config_nuxt_host
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user