socketio / socket.io-client

Realtime application framework (client)
https://socket.io
10.62k stars 3.04k forks source link

Webpack build issues with 1.4.1 #933

Closed mlucool closed 7 years ago

mlucool commented 8 years ago

With 1.4.1 I am seeing the following issue from Webpack. My code has no issues with 1.4.0

WARNING in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js
Module not found: Error: Cannot resolve module 'bufferutil' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
 @ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/BufferUtil.js 10:19-40

WARNING in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js
Module not found: Error: Cannot resolve module 'utf-8-validate' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
 @ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/Validation.js 10:19-44

ERROR in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js
Module not found: Error: Cannot resolve module 'tls' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/lib
 @ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/lib/WebSocketServer.js 15:10-24

ERROR in ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js
Module not found: Error: Cannot resolve module 'fs' in /u//WebStormProjects/myProject/node_modules/mySubApp/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/options/lib
 @ ./~/mySubApp/~/socket.io-client/~/engine.io-client/~/ws/~/options/lib/options.js 6:9-22
crebuh commented 7 years ago

@darrachequesne

when I'm trying to import with

import io from 'socket.io-client'

TS is telling me that the module has no default export

kdw3lch commented 7 years ago

@crebuh Add types for typescript. npm i @types/socket.io-client

crebuh commented 7 years ago

@kdw3lch

nope it is not working I already had types in version 1.4.29 and upgraded the socket.io-client from 1.7.3 to 2.0.3, still the same problem.

maybe my tsconfig.json is wrong, any ideas?

kdw3lch commented 7 years ago

@crebuh I should have read more carefully! import * as io from 'socket.io-client'

dewwwald commented 7 years ago

I am seeing this issue with webpack ^2.0.0 and no socket.io in package. When I run karma I am getting this.

Not sure where to go from here ITO debugging.

rookiebulls commented 7 years ago

adding socket.io-client to dependencies in my package.json fixed the problem for me

pdarii commented 6 years ago

I had the similar, issue when i made checkout of existing project. I run npm -i, all dependency's were installed, but this error appears:

" Can't resolve 'engine.io-client' "

Was fixed by installing socket.io-client.

npm i socket.io-client