-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependencies bufferutil and utf-8-validate are listed as devDependencies #659
Comments
No, they are dev dependencies, nothing in this library depends directly on it. The error is somewhere in your own code or the library that consumes this library. Arnout Kazemier
|
For what it's worth, I had the same trouble in my custom version of https://github.com/erikras/react-redux-universal-hot-example and removing everything related to Socket.IO got rid of all the errors. Maybe worth investigating if they have new minor/patch versions released that got automatically updated. |
Yes I now understand that the error occurs when browserify is used with this project. It does not handle the try-catch around the non existing dependencies. Is there a good solution for handling this? |
@TheLudd It's really a bug in browserify for not understanding conditional imports. Anyways, i'm going to close this bug for now. If there are concrete fixes that I can do in this module to make bundling easier, feel free to give me a poke. |
For some reason browserify complained about mdns, which definitely is not needed in browser environment. Ws has bufferutil and utf-8-validate as optional dependencies, but browserify fails on them, so ignore them. See websockets/ws#659. Fix also bundle generation, the pipe looks like a bug or some shell specific feature(?). This produces 3.5M bundle.js.
Just installed 3.0.0, can't even get it to build with webpack. Same error. import WebSocket from 'ws'; This is client-side browser code. Am I not suppose to use the 'ws' lib client-side? Should I use the native browser implementation? Is this incorrect? |
This is a node client, not a front-end library. |
@3rd-Eden So I should just use native websocket? |
Yes |
Thank you for your time. |
I just found a solution. The problem has been described above : those two libraries are not at all required by My simple solution was simply to create fake modules in my
Then those two modules will be indluded in your bundle and an import or require will not crash :). |
for what its worth: with rollup, you can configure the commonjs plugin to ignore import commonJs from '@rollup/plugin-commonjs';
// rollup.config.js
{
plugins: [
commonJs({
ignore: ['bufferutil', 'utf-8-validate'], // Ignore optional peer dependencies of ws
}),
]
} for me, this resolved this problem. |
ty @swissmanu helped me out! |
My app has this library as a child dependency. I can currently not start it since I get errors saying that module
bufferutil
andutf-8-validate
cannot be found. The errors originate from this module I notice that the two dependencies are listed as devDependencies. Could they be included as regular dependencies?The text was updated successfully, but these errors were encountered: