@@ -2380,7 +2380,20 @@ const makeModernScssWorker = (
2380
2380
? fileURLToPath ( context . containingUrl )
2381
2381
: options . filename
2382
2382
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
2384
2397
} ,
2385
2398
async load ( canonicalUrl ) {
2386
2399
const ext = path . extname ( canonicalUrl . pathname )
@@ -2469,7 +2482,15 @@ const makeModernCompilerScssWorker = (
2469
2482
url ,
2470
2483
cleanScssBugUrl ( importer ) ,
2471
2484
)
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
2473
2494
} ,
2474
2495
async load ( canonicalUrl ) {
2475
2496
const ext = path . extname ( canonicalUrl . pathname )
0 commit comments