mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +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 '.'
|
||||
|
||||
async function _main () {
|
||||
const rootDir = resolve(process.cwd(), process.argv[2] || '.')
|
||||
const nuxt = await loadNuxt({ for: 'dev', rootDir })
|
||||
const args = process.argv.splice(2)
|
||||
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)
|
||||
console.log('Listening:', url)
|
||||
}
|
||||
|
||||
await build(nuxt)
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,9 @@ function basePlugins (ctx: WebpackConfigContext) {
|
||||
config.plugins.push(new WebpackBar({
|
||||
name: ctx.name,
|
||||
color: colors[ctx.name],
|
||||
reporters: ['basic'],
|
||||
reporters: ['basic', 'stats'],
|
||||
basic: true,
|
||||
stats: !ctx.isDev,
|
||||
reporter: {
|
||||
change: (_, { shortPath }) => {
|
||||
if (!ctx.isServer) {
|
||||
|
Loading…
Reference in New Issue
Block a user