Nuxt/packages/cli/src/commands/build.ts

19 lines
473 B
TypeScript
Raw Normal View History

2021-04-15 19:17:44 +00:00
import { resolve } from 'path'
import { requireModule } from '../utils/cjs'
2021-04-09 15:52:45 +00:00
export async function invoke (args) {
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2021-04-15 19:17:44 +00:00
const rootDir = resolve(args._[0] || '.')
const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir)
2021-04-09 15:52:45 +00:00
2021-04-15 19:17:44 +00:00
const nuxt = await loadNuxt({ rootDir })
2021-04-09 15:52:45 +00:00
await buildNuxt(nuxt)
}
export const meta = {
usage: 'nu build [rootDir]',
description: 'Build nuxt for production deployment'
}