Skip to content

Commit f552645

Browse files
committed
perf: handle CSS resolution for relative and absolute paths
1 parent 44c66f5 commit f552645

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

packages/vuetify-nuxt-module/src/vite/vuetify-styles-plugin.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,29 @@ export function vuetifyStylesPlugin (
6666
&& source.endsWith('.css')
6767
&& isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)
6868
) {
69-
const resolution = await this.resolve(source, importer, { skipSelf: true, custom })
70-
if (!resolution) {
69+
let resolutionId: string | undefined
70+
71+
if (source.startsWith('.')) {
72+
resolutionId = path.resolve(path.dirname(importer), source)
73+
} else if (path.isAbsolute(source)) {
74+
resolutionId = source
75+
} else {
76+
const resolution = await this.resolve(source, importer, { skipSelf: true, custom })
77+
if (resolution) {
78+
resolutionId = resolution.id
79+
}
80+
}
81+
82+
if (!resolutionId) {
7183
return
7284
}
7385

74-
const target = await resolveCss(resolution.id)
75-
if (target.startsWith(PREFIX) || target.startsWith(SSR_PREFIX)) {
76-
return target
86+
if (resolutionId.startsWith(PREFIX) || resolutionId.startsWith(SSR_PREFIX)) {
87+
return resolutionId
7788
}
7889

90+
const target = await resolveCss(resolutionId)
91+
7992
if (isNone) {
8093
noneFiles.add(target)
8194
return target

0 commit comments

Comments
 (0)