mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 01:53:55 +00:00
19 lines
453 B
TypeScript
19 lines
453 B
TypeScript
|
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)
|
||
|
})
|
||
|
}
|