Skip to content

Commit

Permalink
fix: dedupe imports (#229)
Browse files Browse the repository at this point in the history
* fix: dedupe imports

* chore: initialize date picker inclusion properly
  • Loading branch information
userquin authored May 21, 2024
1 parent 97619c6 commit d4b3d47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vuetify-nuxt-module",
"type": "module",
"version": "0.14.0",
"packageManager": "[email protected].0",
"packageManager": "[email protected].2",
"description": "Zero-Config Nuxt Module for Vuetify",
"author": "userquin <[email protected]>",
"license": "MIT",
Expand Down
3 changes: 3 additions & 0 deletions playground/vuetify.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export default defineVuetifyConfiguration({
},
aliases: {
MyBadge: 'VBadge',
MyBadge2: 'VBadge',
VDatePicker2: 'VDatePicker',
VDatePicker3: 'VDatePicker',
},
directives: ['ClickOutside', 'Resize', 'Ripple'],
components: ['VDialog', 'VExpansionPanel', 'VExpansionPanelText', 'VExpansionPanelTitle'],
Expand Down
8 changes: 5 additions & 3 deletions src/vite/vuetify-configuration-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,13 @@ async function buildConfiguration(ctx: VuetifyNuxtContext) {
})

componentsToImport.forEach((componentsArray, from) => {
config.imports.push(`import {${componentsArray.join(',')}} from 'vuetify/components/${from}'`)
config.imports.push(`import {${Array.from(new Set(componentsArray)).join(',')}} from 'vuetify/components/${from}'`)
})

// lab components
let addDatePicker = true
let addDatePicker = ctx.vuetify3_4 === true
? !Array.from(componentsToImport.values()).some(components => components.includes('VDatePicker'))
: true

if (labComponents) {
const useLabComponents: LabComponentName[] = []
Expand Down Expand Up @@ -229,7 +231,7 @@ async function buildConfiguration(ctx: VuetifyNuxtContext) {
}

componentsToImport.forEach((componentsArray, from) => {
config.imports.push(`import {${componentsArray.join(',')}} from 'vuetify/labs/${from}'`)
config.imports.push(`import {${Array.from(new Set(componentsArray)).join(',')}} from 'vuetify/labs/${from}'`)
})
}
}
Expand Down

0 comments on commit d4b3d47

Please sign in to comment.