mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +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 = {
|
export const componentsTemplate = {
|
||||||
filename: 'components.mjs',
|
filename: 'components.mjs',
|
||||||
getContents (options: ComponentsTemplateOptions) {
|
getContents ({ options }: { options: ComponentsTemplateOptions }) {
|
||||||
return `import { defineAsyncComponent } from 'vue'
|
return `import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
@ -50,7 +50,7 @@ export default function (nuxt) {
|
|||||||
export const componentsTypeTemplate = {
|
export const componentsTypeTemplate = {
|
||||||
filename: 'components.d.ts',
|
filename: 'components.d.ts',
|
||||||
write: true,
|
write: true,
|
||||||
getContents: (options: ComponentsTemplateOptions) => `// Generated by components discovery
|
getContents: ({ options }: { options: ComponentsTemplateOptions }) => `// Generated by components discovery
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
${options.components.map(c => ` '${c.pascalName}': typeof import('${relative(options.buildDir, c.filePath)}')['${c.export}']`).join(',\n')}
|
${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