Ensure tsconfig.node.json generated during prepare
Some checks failed
build-website / build (push) Failing after 58s
Some checks failed
build-website / build (push) Failing after 58s
This commit is contained in:
@@ -145,15 +145,21 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
|
|
||||||
hooks: {
|
hooks: {
|
||||||
'prepare:types': () => {
|
'prepare:types': (payload) => {
|
||||||
const buildDir = join(process.cwd(), '.nuxt')
|
const nuxt = payload?.nuxt ?? payload
|
||||||
const content = JSON.stringify({ extends: './tsconfig.json' }, null, 2)
|
const buildDir = nuxt?.options?.buildDir ?? join(process.cwd(), '.nuxt')
|
||||||
for (const file of ['tsconfig.app.json', 'tsconfig.shared.json']) {
|
|
||||||
const target = join(buildDir, file)
|
const ensureTsconfig = (filename, extendsPath) => {
|
||||||
|
const target = join(buildDir, filename)
|
||||||
if (!existsSync(target)) {
|
if (!existsSync(target)) {
|
||||||
writeFileSync(target, content + '\n', 'utf8')
|
const json = JSON.stringify({ extends: extendsPath }, null, 2) + '\n'
|
||||||
|
writeFileSync(target, json, 'utf8')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensureTsconfig('tsconfig.app.json', './tsconfig.json')
|
||||||
|
ensureTsconfig('tsconfig.shared.json', './tsconfig.json')
|
||||||
|
ensureTsconfig('tsconfig.node.json', './tsconfig.server.json')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user