mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): augment GlobalComponents
in multiple vue modules (#26541)
This commit is contained in:
parent
871404ae56
commit
22dfac7bd7
@ -109,12 +109,22 @@ export const componentsTypeTemplate = {
|
||||
: c.filePath.replace(/(?<=\w)\.(?!vue)\w+$/g, ''), { wrapper: false })}['${c.export}']`
|
||||
])
|
||||
|
||||
return `// Generated by components discovery
|
||||
return `
|
||||
interface _GlobalComponents {
|
||||
${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join('\n')}
|
||||
${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join('\n')}
|
||||
}
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents extends _GlobalComponents { }
|
||||
}
|
||||
|
||||
declare module '@vue/runtime-dom' {
|
||||
export interface GlobalComponents extends _GlobalComponents { }
|
||||
}
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
${componentTypes.map(([pascalName, type]) => ` '${pascalName}': ${type}`).join('\n')}
|
||||
${componentTypes.map(([pascalName, type]) => ` 'Lazy${pascalName}': ${type}`).join('\n')}
|
||||
}
|
||||
export interface GlobalComponents extends _GlobalComponents { }
|
||||
}
|
||||
|
||||
${componentTypes.map(([pascalName, type]) => `export const ${pascalName}: ${type}`).join('\n')}
|
||||
|
@ -32,7 +32,22 @@ export default defineUntypedSchema({
|
||||
*/
|
||||
hoist: {
|
||||
$resolve: (val) => {
|
||||
const defaults = ['nitropack', 'defu', 'h3', '@unhead/vue', 'vue', 'vue-router', '@nuxt/schema', 'nuxt', 'consola', 'ofetch']
|
||||
const defaults = [
|
||||
// Nitro auto-imported/augmented dependencies
|
||||
'nitropack',
|
||||
'defu',
|
||||
'h3',
|
||||
'consola',
|
||||
'ofetch',
|
||||
// Key nuxt dependencies
|
||||
'@unhead/vue',
|
||||
'vue',
|
||||
'@vue/runtime-core',
|
||||
'@vue/runtime-dom',
|
||||
'vue-router',
|
||||
'@nuxt/schema',
|
||||
'nuxt'
|
||||
]
|
||||
return val === false ? [] : (Array.isArray(val) ? val.concat(defaults) : defaults)
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user