Skip to content

Commit

Permalink
fix(sass): remove query params when resolving virtual sass modules (#278
Browse files Browse the repository at this point in the history
)
  • Loading branch information
userquin authored Sep 13, 2024
1 parent 4faed02 commit c853c0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 4 additions & 9 deletions src/utils/configure-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@ export function configureVite(configKey: string, nuxt: Nuxt, ctx: VuetifyNuxtCon
if (enableModernSassCompiler) {
const sassEmbedded = isPackageExists('sass-embedded')
if (sassEmbedded) {
// vite version >= 5.4.2
// check https://github.com/vitejs/vite/pull/17754 and https://github.com/vitejs/vite/pull/17728
const omit = major > 5 || (major === 5 && minor > 4) || (major === 5 && minor === 4 && patch >= 2)
if (!omit) {
viteInlineConfig.css ??= {}
viteInlineConfig.css.preprocessorOptions ??= {}
viteInlineConfig.css.preprocessorOptions.sass ??= {}
viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
}
viteInlineConfig.css ??= {}
viteInlineConfig.css.preprocessorOptions ??= {}
viteInlineConfig.css.preprocessorOptions.sass ??= {}
viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
}
else {
viteInlineConfig.css ??= {}
Expand Down
9 changes: 7 additions & 2 deletions src/vite/vuetify-styles-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ export function vuetifyStylesPlugin(
}
},
async resolveId(source, importer, { custom, ssr }) {
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX))
return source
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
if (source.endsWith('.sass'))
return source

const idx = source.indexOf('?')
return idx > -1 ? source.slice(0, idx) : source
}

if (
source === 'vuetify/styles' || (
Expand Down

0 comments on commit c853c0f

Please sign in to comment.