itgalaxy / webfont

Awesome generator of webfont
MIT License
275 stars 69 forks source link

fix: module not found: Error: Can't resolve 'fs' #198

Open arshbot opened 4 years ago

arshbot commented 4 years ago

Installed this project and attempted to use for a simple reactjs app, however I get Module not found: Error: Can't resolve 'fs'

Some logs below

webpack is watching the files…                                                                                                                                                                                                                

Hash: 70050155cee77a81d4b4                                                                                                                                                                                                                    
Version: webpack 4.43.0                                                                                                                                                                                                                       
Time: 6734ms                                                                                                                                                                                                                                  
Built at: 05/08/2020 8:50:06 PM                                                                                                                                                                                                               
  Asset      Size  Chunks             Chunk Names                                                                                                                                                                                             
main.js  12.8 MiB    main  [emitted]  main                                                                                                                                                                                                    
Entrypoint main = main.js                                                                                                                                                                                                                     
[0] util (ignored) 15 bytes {main} [built]                                                                                                                                                                                                    
[1] util (ignored) 15 bytes {main} [built]                                                                                                                                                                                                    
[../../../../node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]                                                                                                                                     
[../../../../node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]                                                                                                                                     
[./node_modules/import-fresh sync recursive] ./node_modules/import-fresh sync 160 bytes {main} [built]                                                                                                                                        
[./node_modules/moment/locale sync recursive ^\.\/.*$] ./node_modules/moment/locale sync ^\.\/.*$ 3.13 KiB {main} [optional] [built]                                                                                                          
[./src/index.js] 35 bytes {main} [built]                                                                                                                                                                                                      
    + 3263 hidden modules                                                                                                                                                                                                                     

WARNING in ./node_modules/import-fresh/index.js 28:8-25                                                                                                                                                                                       
Critical dependency: the request of a dependency is an expression                                                                                                                                                                             
 @ ./node_modules/cosmiconfig/dist/loaders.js                                                                                                                                                                                                 
 @ ./node_modules/cosmiconfig/dist/index.js                                                                                                                                                                                                   
 @ ./node_modules/webfont/dist/standalone.js                                                                                                                                                                                                  
 @ ./node_modules/webfont/dist/index.js                                                                                                                                                                                                       
 @ ./src/components/App.js                                                                                                                                                                                                                    
 @ ./src/index.js                                                                                                                                                                                                                             

ERROR in ./node_modules/@mrmlnc/readdir-enhanced/lib/async/index.js                                                                                                                                                                           
Module not found: Error: Can't resolve 'fs' in '/home/harshagoli/Projects/ssss-django/sss_server/sss_react/node_modules/@mrmlnc/readdir-enhanced/lib/async'                                                                                   
 @ ./node_modules/@mrmlnc/readdir-enhanced/lib/async/index.js 9:6-19                                                                                                                                                                          
 @ ./node_modules/@mrmlnc/readdir-enhanced/lib/index.js                                                                                                                                                                                       
 @ ./node_modules/fast-glob/out/providers/reader-async.js                                                                                                                                                                                     
 @ ./node_modules/fast-glob/out/index.js                                                                                                                                                                                                      
 @ ./node_modules/fast-glob/index.js                                                                                                                                                                                                          
 @ ./node_modules/globby/index.js                                                                                                                                                                                                             
 @ ./node_modules/webfont/dist/standalone.js                                                                                                                                                                                                  
 @ ./node_modules/webfont/dist/index.js                                                                                                                                                                                                       
 @ ./src/components/App.js                                                                                                                                                                                                                    
 @ ./src/index.js                                                                                                                                                                                                                             

ERROR in ./node_modules/@mrmlnc/readdir-enhanced/lib/stream/index.js                                                                                                                                                                          
Module not found: Error: Can't resolve 'fs' in '/home/harshagoli/Projects/ssss-django/sss_server/sss_react/node_modules/@mrmlnc/readdir-enhanced/lib/stream'                                                                                  
 @ ./node_modules/@mrmlnc/readdir-enhanced/lib/stream/index.js 8:6-19                                                                                                                                                                         
 @ ./node_modules/@mrmlnc/readdir-enhanced/lib/index.js                                                                
 @ ./node_modules/fast-glob/out/providers/reader-async.js                                                              
 @ ./node_modules/fast-glob/out/index.js                                                                               
 @ ./node_modules/fast-glob/index.js                                                                                   
 @ ./node_modules/globby/index.js                                                                                      
 @ ./node_modules/webfont/dist/standalone.js                                                                           
 @ ./node_modules/webfont/dist/index.js                                                                                
 @ ./src/components/App.js                                 
 @ ./src/index.js                                          
jimmyandrade commented 3 years ago

@arshbot Thank you for using webfont. I'm sorry you're experiencing this error.

  1. Have you tried to deleted all the packages from node_modules/ and do a npm install/yarn?
  2. Is there some browser entry on your package.json. If yes, is there a fs property with value false or true?
  3. Could you send a minimal example for reproduction or, at least, your package.json and webpack.config files?