fix(nuxi): ensure types are calculated on current nuxt instance (#1432)

This commit is contained in:
Daniel Roe 2021-10-25 12:04:27 +01:00 committed by GitHub
parent c6f769e94d
commit 79664ad611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,6 @@ export default defineNuxtCommand({
const { loadNuxt, buildNuxt } = await loadKit(rootDir) const { loadNuxt, buildNuxt } = await loadKit(rootDir)
const prepare = debounce((nuxt: Nuxt) => writeTypes(nuxt), 1000)
let currentNuxt: Nuxt let currentNuxt: Nuxt
const load = async (isRestart: boolean, reason?: string) => { const load = async (isRestart: boolean, reason?: string) => {
try { try {
@ -53,7 +51,7 @@ export default defineNuxtCommand({
} }
const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false }) const newNuxt = await loadNuxt({ rootDir, dev: true, ready: false })
await clearDir(newNuxt.options.buildDir) await clearDir(newNuxt.options.buildDir)
prepare(newNuxt) writeTypes(newNuxt).catch(console.error)
currentNuxt = newNuxt currentNuxt = newNuxt
await currentNuxt.ready() await currentNuxt.ready()
await buildNuxt(currentNuxt) await buildNuxt(currentNuxt)