Skip to content

Commit c853c0f

Browse files
authored
fix(sass): remove query params when resolving virtual sass modules (#278)
1 parent 4faed02 commit c853c0f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/utils/configure-vite.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,10 @@ export function configureVite(configKey: string, nuxt: Nuxt, ctx: VuetifyNuxtCon
5050
if (enableModernSassCompiler) {
5151
const sassEmbedded = isPackageExists('sass-embedded')
5252
if (sassEmbedded) {
53-
// vite version >= 5.4.2
54-
// check https://github.com/vitejs/vite/pull/17754 and https://github.com/vitejs/vite/pull/17728
55-
const omit = major > 5 || (major === 5 && minor > 4) || (major === 5 && minor === 4 && patch >= 2)
56-
if (!omit) {
57-
viteInlineConfig.css ??= {}
58-
viteInlineConfig.css.preprocessorOptions ??= {}
59-
viteInlineConfig.css.preprocessorOptions.sass ??= {}
60-
viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
61-
}
53+
viteInlineConfig.css ??= {}
54+
viteInlineConfig.css.preprocessorOptions ??= {}
55+
viteInlineConfig.css.preprocessorOptions.sass ??= {}
56+
viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
6257
}
6358
else {
6459
viteInlineConfig.css ??= {}

src/vite/vuetify-styles-plugin.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ export function vuetifyStylesPlugin(
4848
}
4949
},
5050
async resolveId(source, importer, { custom, ssr }) {
51-
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX))
52-
return source
51+
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
52+
if (source.endsWith('.sass'))
53+
return source
54+
55+
const idx = source.indexOf('?')
56+
return idx > -1 ? source.slice(0, idx) : source
57+
}
5358

5459
if (
5560
source === 'vuetify/styles' || (

0 commit comments

Comments
 (0)