I'm using a project with react-redux-starter-kit
module, I installed geoip-lite
module, and when I imported it, the errors said in the title appeared.
ERROR in ./~/geoip-lite/lib/geoip.js
Module not found: Error: Cannot resolve module 'fs' in <path>/node_modules/geoip-lite/lib
@ ./~/geoip-lite/lib/geoip.js 1:9-22
ERROR in ./~/geoip-lite/lib/fsWatcher.js
Module not found: Error: Cannot resolve module 'fs' in <path>/node_modules/geoip-lite/lib
@ ./~/geoip-lite/lib/fsWatcher.js 1:9-22
In webpack.config.js
file, I've already tried to modify the target
to node
instead of web
, which is the default, but then the warning below appeared and the website running locally got all blank.
WARNING in ./~/encoding/lib/iconv-loader.js
Critical dependencies:
9:12-34 the request of a dependency is an expression
@ ./~/encoding/lib/iconv-loader.js 9:12-34
I've also added node: { fs: 'empty' }
in the file, but then, this error in the screen:
TypeError: fs.openSync is not a function
I tried to install fs
within the module and also download fs-extra
and change all occurrences of fs
to fs-extra
, but no success at all. What can be done?