Module not found: Error: Can't resolve 'fs' in './node_modules/docx4js/lib'
Abiram-N opened this issue · comments
Error when running npm start
. Works good in React v17 and react-scripts v4. but fails to run in Reactv18 and react-scripts v5
Compiled with problems:
ERROR in ./node_modules/docx4js/lib/document.js 340:17-45
Module not found: Error: Can't resolve 'fs' in './node_modules/docx4js/lib'
package.json for reference
{
"name": "parser",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"buffer": "^6.0.3",
"docx4js": "^3.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}