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: {
|
||||
'prepare:types': () => {
|
||||
const buildDir = join(process.cwd(), '.nuxt')
|
||||
const content = JSON.stringify({ extends: './tsconfig.json' }, null, 2)
|
||||
for (const file of ['tsconfig.app.json', 'tsconfig.shared.json']) {
|
||||
const target = join(buildDir, file)
|
||||
'prepare:types': (payload) => {
|
||||
const nuxt = payload?.nuxt ?? payload
|
||||
const buildDir = nuxt?.options?.buildDir ?? join(process.cwd(), '.nuxt')
|
||||
|
||||
const ensureTsconfig = (filename, extendsPath) => {
|
||||
const target = join(buildDir, filename)
|
||||
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