@@ -2380,7 +2380,20 @@ const makeModernScssWorker = (
23802380 ? fileURLToPath ( context . containingUrl )
23812381 : options . filename
23822382 const resolved = await internalCanonicalize ( url , importer )
2383- return resolved ? pathToFileURL ( resolved ) : null
2383+ if (
2384+ resolved &&
2385+ // only limit to these extensions because:
2386+ // - for the `@import`/`@use`s written in file loaded by `load` function,
2387+ // the `canonicalize` function of that `importer` is called first
2388+ // - the `load` function of an importer is only called for the importer
2389+ // that returned a non-null result from its `canonicalize` function
2390+ ( resolved . endsWith ( '.css' ) ||
2391+ resolved . endsWith ( '.scss' ) ||
2392+ resolved . endsWith ( '.sass' ) )
2393+ ) {
2394+ return pathToFileURL ( resolved )
2395+ }
2396+ return null
23842397 } ,
23852398 async load ( canonicalUrl ) {
23862399 const ext = path . extname ( canonicalUrl . pathname )
@@ -2469,7 +2482,15 @@ const makeModernCompilerScssWorker = (
24692482 url ,
24702483 cleanScssBugUrl ( importer ) ,
24712484 )
2472- return resolved ? pathToFileURL ( resolved ) : null
2485+ if (
2486+ resolved &&
2487+ ( resolved . endsWith ( '.css' ) ||
2488+ resolved . endsWith ( '.scss' ) ||
2489+ resolved . endsWith ( '.sass' ) )
2490+ ) {
2491+ return pathToFileURL ( resolved )
2492+ }
2493+ return null
24732494 } ,
24742495 async load ( canonicalUrl ) {
24752496 const ext = path . extname ( canonicalUrl . pathname )
0 commit comments