Skip to content

Commit

Permalink
fix: wrong import directives (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed Oct 9, 2023
1 parent 48898b5 commit 142197c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion playground/vuetify.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineVuetifyConfiguration({
aliases: {
MyBadge: 'VBadge',
},
directives: true,
directives: ['ClickOutside', 'Resize', 'Ripple'],
components: ['VDialog', 'VExpansionPanel', 'VExpansionPanelText', 'VExpansionPanelTitle'],
labComponents: ['VDataTable', 'VDatePickerControls', 'VDatePickerHeader'],
blueprint: md3,
Expand Down
5 changes: 3 additions & 2 deletions src/vite/vuetify-configuration-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Plugin } from 'vite'
import type { ComponentName, LabComponentName } from '../types'
import type { VuetifyNuxtContext } from '../utils/config'
import { toKebabCase } from '../utils'
import { RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION, VIRTUAL_VUETIFY_CONFIGURATION } from './constants'

interface ImportsResult {
Expand Down Expand Up @@ -115,8 +116,8 @@ async function buildConfiguration(ctx: VuetifyNuxtContext) {
config.directives = 'options.directives = directives'
}
else {
const useDirectives = Array.isArray(directives) ? [...new Set(...directives)] : [directives]
config.imports.push(useDirectives.map(d => `import { ${d} } from 'vuetify/directives/${d}'`).join('\n'))
const useDirectives = Array.isArray(directives) ? [...new Set(directives)] : [directives]
config.imports.push(useDirectives.map(d => `import {${d}} from 'vuetify/directives/${toKebabCase(d)}'`).join('\n'))
config.directives = `options.directives = {${useDirectives.join(',')}}`
}
}
Expand Down

0 comments on commit 142197c

Please sign in to comment.