mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 09:25:54 +00:00
fix(nuxt3): destructure components options (#1165)
This commit is contained in:
parent
adf497046b
commit
117b3aa524
@ -25,7 +25,7 @@ const createImportMagicComments = (options: ImportMagicCommentsOptions) => {
|
||||
|
||||
export const componentsTemplate = {
|
||||
filename: 'components.mjs',
|
||||
getContents (options: ComponentsTemplateOptions) {
|
||||
getContents ({ options }: { options: ComponentsTemplateOptions }) {
|
||||
return `import { defineAsyncComponent } from 'vue'
|
||||
|
||||
const components = {
|
||||
@ -50,7 +50,7 @@ export default function (nuxt) {
|
||||
export const componentsTypeTemplate = {
|
||||
filename: 'components.d.ts',
|
||||
write: true,
|
||||
getContents: (options: ComponentsTemplateOptions) => `// Generated by components discovery
|
||||
getContents: ({ options }: { options: ComponentsTemplateOptions }) => `// Generated by components discovery
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
${options.components.map(c => ` '${c.pascalName}': typeof import('${relative(options.buildDir, c.filePath)}')['${c.export}']`).join(',\n')}
|
||||
|
Loading…
Reference in New Issue
Block a user