File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed 
src/components/MDX/Sandpack Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ const nextConfig = {
3636    // Don't bundle the shim unnecessarily. 
3737    config . resolve . alias [ 'use-sync-external-store/shim' ]  =  'react' ; 
3838
39+     // ESLint depends on the CommonJS version of esquery, 
40+     // but Webpack loads the ESM version by default. This 
41+     // alias ensures the correct version is used. 
42+     // 
43+     // More info: 
44+     // https://github.com/reactjs/react.dev/pull/8115 
45+     config . resolve . alias [ 'esquery' ]  =  'esquery/dist/esquery.min.js' ; 
46+ 
3947    const  { IgnorePlugin,  NormalModuleReplacementPlugin}  =  require ( 'webpack' ) ; 
4048    config . plugins . push ( 
4149      new  NormalModuleReplacementPlugin ( 
Original file line number Diff line number Diff line change @@ -21,13 +21,6 @@ const getCodeMirrorPosition = (
2121
2222const  linter  =  new  Linter ( ) ; 
2323
24- // HACK! Eslint requires 'esquery' using `require`, but there's no commonjs interop. 
25- // because of this it tries to run `esquery.parse()`, while there's only `esquery.default.parse()`. 
26- // This hack places the functions in the right place. 
27- const  esquery  =  require ( 'esquery' ) ; 
28- esquery . parse  =  esquery . default ?. parse ; 
29- esquery . matches  =  esquery . default ?. matches ; 
30- 
3124const  reactRules  =  require ( 'eslint-plugin-react-hooks' ) . rules ; 
3225linter . defineRules ( { 
3326  'react-hooks/rules-of-hooks' : reactRules [ 'rules-of-hooks' ] , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments