File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed 
packages/nextjs/src/config/loaders Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 11import  *  as  fs  from  'fs' ; 
22import  *  as  path  from  'path' ; 
33
4+ import  {  LoaderThis  }  from  './types' ; 
5+ 
46type  LoaderOptions  =  { 
57  distDir : string ; 
68} ; 
7- // TODO Use real webpack types 
8- type  LoaderThis  =  { 
9-   // Webpack 4 
10-   query ?: LoaderOptions ; 
11-   // Webpack 5 
12-   getOptions ?: ( )  =>  LoaderOptions ; 
13-   addDependency : ( filepath : string )  =>  void ; 
14- } ; 
159
1610/** 
1711 * Inject templated code into the beginning of a module. 
1812 */ 
19- function  prefixLoader ( this : LoaderThis ,  userCode : string ) : string  { 
13+ function  prefixLoader ( this : LoaderThis < LoaderOptions > ,  userCode : string ) : string  { 
2014  // We know one or the other will be defined, depending on the version of webpack being used 
2115  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 
2216  const  {  distDir }  =  this . getOptions  ? this . getOptions ( )  : this . query ! ; 
Original file line number Diff line number Diff line change 1+ // TODO Use real webpack types 
2+ export  type  LoaderThis < Options >  =  { 
3+   // Loader options in Webpack 4 
4+   query ?: Options ; 
5+   // Loader options in Webpack 5 
6+   getOptions ?: ( )  =>  Options ; 
7+ 
8+   // Function to add outside file used by loader to `watch` process 
9+   addDependency : ( filepath : string )  =>  void ; 
10+ } ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments