Nuxt/packages/nuxt3/src/cli.ts

19 lines
453 B
TypeScript
Raw Normal View History

2021-01-20 14:43:43 +00:00
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 [{ url }] = await nuxt.server.listen(3000)
console.log('Listening:', url)
await build(nuxt)
}
export function main () {
_main()
.catch((error) => {
require('consola').fatal(error)
require('exit')(2)
})
}