-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Error: Can't resolve 'uws' #575
Comments
This is discussed in an issue on the socket.io repo (socketio/socket.io#3342), but I think it's more appropriate here. I found codymikol's answer very helpful:
|
@sethcwhiting unfortunately this version doesn't work with node 10 and higher. At least if you want to use a secure connection(wss). We didn't want to step over to the javascript ws package and we created a new uws package and added support for node 10 and node 12. |
I'm running in to this same issue right now, trying to bundle server code up. Looks like Thinking I can just define it as an empty module in Webpack considering I don't toggle on the |
Then what's the solution for this? |
@Femina installing the new uws package that @mmdevries mentioned seems to work for me so far... |
Is there a reason why uws can't be moved out of the devDependencies and into the dependencies alongside ws as @TylerR909 implied? I had the same problem with webpack and made a local edit to the package.json and now everything is OK. |
If you are here because your Problem ExplanationIn recent However, SolutionSimply tell it to not bundle it by adding E.g.: module.exports = {
// ...
externals: {
uws: 'uws'
}
}; |
So that bundlers like webpack do not try to include it in the build. As a side-effect, any implementation which matches the API of the ws module can now be used. Before that change, you had to explicitly exclude uws: ``` // webpack.config.js module.exports = { // ... externals: { uws: 'uws' } }; ``` Related: #575
So that bundlers like webpack do not try to include it in the build. As a side-effect, any implementation which matches the API of the ws module can now be used. Before that change, you had to explicitly exclude uws: ``` // webpack.config.js module.exports = { // ... externals: { uws: 'uws' } }; ``` Related: #575 Backported from master: 82cdca2
So that bundlers like webpack do not try to include it in the build. As a side-effect, any implementation which matches the API of the ws module can now be used. Before that change, you had to explicitly exclude uws: ``` // webpack.config.js module.exports = { // ... externals: { uws: 'uws' } }; ``` Related: #575 Backported from master: 82cdca2
This should be fixed by 85e544a, included in engine.io@3.4.2. Edit: I've updated the example here: https://github.com/socketio/socket.io/tree/master/examples/webpack-build-server |
Note: for support questions, please use one of these channels: stackoverflow or slack
You want to:
Current behaviour
I use socket.io, therefore engine.io is one of my depended packages.
When I try to bundle my project, I have error
Module not found: Error: Can't resolve 'uws' in node_modules/engine.io/lib/server.js
(The error would not be here if I configure webpack with
webpack-node-externals
, but I really need all packages in a single bundle for docker container.)Steps to reproduce (if the current behaviour is a bug)
Expected behaviour
It should create a bundle without errors.
Setup
Other information (e.g. stacktraces, related issues, suggestions how to fix)
IMO it could be fixed if engine.io declares uws as a prod dependency (not a dev dependency).
The text was updated successfully, but these errors were encountered: