File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,27 @@ const scssConfigIndex = baseClientWebpackConfig.module.rules.findIndex((config)
2727  '.scss' . match ( config . test ) , 
2828) ; 
2929
30+ // Configure sass-loader to use the modern API 
31+ const  scssRule  =  baseClientWebpackConfig . module . rules [ scssConfigIndex ] ; 
32+ const  sassLoaderIndex  =  scssRule . use . findIndex ( ( loader )  =>  
33+   loader . loader  ===  'sass-loader'  ||  ( typeof  loader  ===  'string'  &&  loader . includes ( 'sass-loader' ) ) 
34+ ) ; 
35+ 
36+ if  ( sassLoaderIndex  !==  - 1 )  { 
37+   const  sassLoader  =  scssRule . use [ sassLoaderIndex ] ; 
38+   if  ( typeof  sassLoader  ===  'string' )  { 
39+     scssRule . use [ sassLoaderIndex ]  =  { 
40+       loader : 'sass-loader' , 
41+       options : { 
42+         api : 'modern' 
43+       } 
44+     } ; 
45+   }  else  { 
46+     sassLoader . options  =  sassLoader . options  ||  { } ; 
47+     sassLoader . options . api  =  'modern' ; 
48+   } 
49+ } 
50+ 
3051baseClientWebpackConfig . module . rules [ scssConfigIndex ] . use . push ( sassLoaderConfig ) ; 
3152
3253// Copy the object using merge b/c the baseClientWebpackConfig and commonOptions are mutable globals 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments