diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts index 28aad6814969ce..873bcfc360d79b 100644 --- a/packages/vite/src/node/plugins/css.ts +++ b/packages/vite/src/node/plugins/css.ts @@ -2382,6 +2382,11 @@ const makeModernScssWorker = ( const resolved = await internalCanonicalize(url, importer) if ( resolved && + // only limit to these extensions because: + // - for the `@import`/`@use`s written in file loaded by `load` function, + // the `canonicalize` function of that `importer` is called first + // - the `load` function of an importer is only called for the importer + // that returned a non-null result from its `canonicalize` function (resolved.endsWith('.css') || resolved.endsWith('.scss') || resolved.endsWith('.sass'))