I faced this problem while I try to use socket in react ,I know it said I should use export default instead of module.export but this piece of code exist in socket package itself and when I change it it through error
I work with node version v14.17.0
these are the packages and react version I use
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"socket.io-client": "^4.3.1",
"web-vitals": "^1.0.1"
},
This is the piece of code in socket package which cause this error
Object.assign(lookup, {
Manager,
Socket,
io: lookup,
connect: lookup,
});
if (typeof module !== "undefined") {
module.exports = lookup;
}
