fix(nuxt): generate empty file when shim is disabled (#23333)

This commit is contained in:
Daniel Roe 2023-09-22 09:20:29 +02:00 committed by GitHub
parent dd0ffaa84c
commit a2fb8234ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,14 +18,19 @@ interface TemplateContext {
export const vueShim: NuxtTemplate = {
filename: 'types/vue-shim.d.ts',
getContents: () =>
[
getContents: ({ nuxt }) => {
if (!nuxt.options.typescript.shim) {
return ''
}
return [
'declare module \'*.vue\' {',
' import { DefineComponent } from \'vue\'',
' const component: DefineComponent<{}, {}, any>',
' export default component',
'}'
].join('\n')
}
}
// TODO: Use an alias