fix(nuxi): ensure buildDir exists before write

This commit is contained in:
Pooya Parsa 2021-12-01 21:40:40 +01:00
parent bd36e1351a
commit 1ef6e3f525

View File

@ -87,6 +87,7 @@ export const writeTypes = async (nuxt: Nuxt) => {
const GeneratedBy = '// Generated by nuxi' const GeneratedBy = '// Generated by nuxi'
const tsConfigPath = resolve(nuxt.options.buildDir, 'tsconfig.json') const tsConfigPath = resolve(nuxt.options.buildDir, 'tsconfig.json')
await fsp.mkdir(nuxt.options.buildDir, { recursive: true })
await fsp.writeFile(tsConfigPath, GeneratedBy + '\n' + JSON.stringify(tsConfig, null, 2)) await fsp.writeFile(tsConfigPath, GeneratedBy + '\n' + JSON.stringify(tsConfig, null, 2))
const declarationPath = resolve(nuxt.options.buildDir, 'nuxt.d.ts') const declarationPath = resolve(nuxt.options.buildDir, 'nuxt.d.ts')