mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-01 17:43:38 +00:00
nuxt-start: throw error if nuxt build
not called
This commit is contained in:
parent
faa8db4701
commit
9d1765ae91
@ -3,7 +3,7 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const parseArgs = require('minimist')
|
const parseArgs = require('minimist')
|
||||||
const { Nuxt, Server } = require('../')
|
const { Nuxt, Server } = require('../')
|
||||||
const resolve = require('path').resolve
|
const { join, resolve } = require('path')
|
||||||
|
|
||||||
const argv = parseArgs(process.argv.slice(2), {
|
const argv = parseArgs(process.argv.slice(2), {
|
||||||
alias: {
|
alias: {
|
||||||
@ -55,6 +55,13 @@ if (typeof options.rootDir !== 'string') {
|
|||||||
}
|
}
|
||||||
options.dev = false // Force production mode (no webpack middleware called)
|
options.dev = false // Force production mode (no webpack middleware called)
|
||||||
|
|
||||||
|
// Check if project is built for production
|
||||||
|
const distDir = join(options.rootDir, options.buildDir || '.nuxt', 'dist' )
|
||||||
|
if (!fs.existsSync(join(distDir,'server-bundle.json'))) {
|
||||||
|
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`') // eslint-disable-line no-console
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
const nuxt = new Nuxt(options)
|
const nuxt = new Nuxt(options)
|
||||||
const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port
|
const port = argv.port || process.env.PORT || process.env.npm_package_config_nuxt_port
|
||||||
const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host
|
const host = argv.hostname || process.env.HOST || process.env.npm_package_config_nuxt_host
|
||||||
|
Loading…
Reference in New Issue
Block a user