mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
add basic nuxt build
This commit is contained in:
parent
17160c31ed
commit
3d06693f88
@ -2,10 +2,21 @@ import { resolve } from 'path'
|
|||||||
import { loadNuxt, build } from '.'
|
import { loadNuxt, build } from '.'
|
||||||
|
|
||||||
async function _main () {
|
async function _main () {
|
||||||
const rootDir = resolve(process.cwd(), process.argv[2] || '.')
|
const args = process.argv.splice(2)
|
||||||
const nuxt = await loadNuxt({ for: 'dev', rootDir })
|
const cmd = args[0]
|
||||||
|
if (!['dev', 'build'].includes(cmd)) {
|
||||||
|
console.error('Usage nuxt dev|build [rootDir]')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
const isDev = cmd === 'dev'
|
||||||
|
const rootDir = resolve(process.cwd(), args[1] || '.')
|
||||||
|
const nuxt = await loadNuxt({ for: isDev ? 'dev' : 'build', rootDir })
|
||||||
|
|
||||||
|
if (isDev) {
|
||||||
const [{ url }] = await nuxt.server.listen(3000)
|
const [{ url }] = await nuxt.server.listen(3000)
|
||||||
console.log('Listening:', url)
|
console.log('Listening:', url)
|
||||||
|
}
|
||||||
|
|
||||||
await build(nuxt)
|
await build(nuxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,8 +79,9 @@ function basePlugins (ctx: WebpackConfigContext) {
|
|||||||
config.plugins.push(new WebpackBar({
|
config.plugins.push(new WebpackBar({
|
||||||
name: ctx.name,
|
name: ctx.name,
|
||||||
color: colors[ctx.name],
|
color: colors[ctx.name],
|
||||||
reporters: ['basic'],
|
reporters: ['basic', 'stats'],
|
||||||
basic: true,
|
basic: true,
|
||||||
|
stats: !ctx.isDev,
|
||||||
reporter: {
|
reporter: {
|
||||||
change: (_, { shortPath }) => {
|
change: (_, { shortPath }) => {
|
||||||
if (!ctx.isServer) {
|
if (!ctx.isServer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user