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
Unable to bundle socket.io client due to undeclared dependency on base64-arraybuffer #116
Comments
Looking at |
Now, it seems yarn v2 is indeed a bit more strict: https://dev.to/arcanis/introducing-yarn-2-4eh1#strict-package-boundaries I guess we'll have to remove this "optimization" to support yarn v2. |
The dependency was previously only listed as dev dependency, so that it was not included when installing the server (the "engine.io" package, which does not require it) and was explicitly included by the client (the "engine.io-client" package, which needs it for the browser build). But it failed with yarn v2, due to its stricter package boundaries: > ERROR in ../../../.yarn/cache/engine.io-parser-npm-4.0.1-6bdb879e8a-3b71ef8b5a.zip/node_modules/engine.io-parser/lib/decodePacket.browser.js 7:18-47 > Module not found: Error: engine.io-parser tried to access base64-arraybuffer, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound. > Required package: base64-arraybuffer (via "base64-arraybuffer") > Required by: engine.io-parser@npm:4.0.1 (via xxx/.yarn/cache/engine.io-parser-npm-4.0.1-6bdb879e8a-3b71ef8b5a.zip/node_modules/engine.io-parser/lib/) Related: - https://dev.to/arcanis/introducing-yarn-2-4eh1#strict-package-boundaries - #116
Closed by 2ccdeb2 (included in |
I'm getting this error once-again on a newer version of this library. I had to revert from |
@darrachequesne I'm not sure if that relates, it sounds likely. I'm unable to create a reproduction repo for you with my current schedule, but I appreciate the response 🙏 |
I'm attempting to bundle the socket.io client with webpack 5 and yarn 2. I believe these have more strict dependency checks which would explain why this issue hasn't been opened for webpack 4 and/or npm users.
Webpack is giving the error
seems like this is accurate since it's being required here
engine.io-parser/lib/decodePacket.browser.js
Line 7 in ea8804e
is there any reason why this isn't included in dependencies and is instead only in devDependencies?
engine.io-parser/package.json
Line 13 in ea8804e
In case there's a native component to this library which causes it to fail compiling for some users, consider following the approach that was eventually taken here websockets/ws#1220, where we would move
base64-arraybuffer
fromdevDependencies
tooptionalDependencies
.I can open a PR if this approach (move to optional dependencies) works for you.
The text was updated successfully, but these errors were encountered: