File tree 1 file changed +10
-5
lines changed
packages/next-swc/crates/next-core/src
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,19 @@ pub async fn maybe_add_sass_loader(
39
39
} ;
40
40
41
41
if let Some ( rule) = rule {
42
+ // Without `as`, loader result would be JS code, so we don't want to apply
43
+ // sass-loader on that.
44
+ let Some ( rename_as) = rule. rename_as . as_ref ( ) else {
45
+ continue ;
46
+ } ;
47
+ // Only when the result should run through the sass pipeline, we apply
48
+ // sass-loader.
49
+ if rename_as != "*" {
50
+ continue ;
51
+ }
42
52
let mut loaders = rule. loaders . await ?. clone_value ( ) ;
43
53
loaders. push ( loader) ;
44
54
rule. loaders = WebpackLoaderItemsVc :: cell ( loaders) ;
45
- if let Some ( rename_as) = rule. rename_as . as_mut ( ) {
46
- rename_as. push_str ( rename) ;
47
- } else {
48
- rule. rename_as = Some ( format ! ( "*{rename}" ) ) ;
49
- }
50
55
} else {
51
56
rules. insert (
52
57
pattern. to_string ( ) ,
You can’t perform that action at this time.
0 commit comments