-
Notifications
You must be signed in to change notification settings - Fork 98
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
Explicit reference to Buffer class (node) #267
Comments
Hey @GaelBi, thanks for the feedback. Can you let me know which version of RSocket you were using? Was it Either way; as you've noted, when building a client side application there are some challenges with the buffer module. I believe you would of encountered this issue even if we explicitly import Given that, this is why providing a Buffer polyfill is important. Currently we expect users of RSocket in client side applications to configure this themselves since it is dependent on the bundler and other technology choices that the application authors have made. If we drop support for older Node versions we may import Buffer directly as you've suggested, however I don't believe it would have resolved your problem in the browser environment with Angular. Let me know if that clears things up. |
Hi @viglucci , Thanks for your answer. The polyfills seem to be less and less used, for exemple, we can read in the documentation of webpack 5 : "...the module landscape changed and many module uses are now written mainly for frontend purposes..." Regards, |
Hey @GaelBi, thanks for the additional comment. I'm happy to give this a try and see if importing from 'node:buffer' produces a bundle which is both browser compatible and doesn't require an explicit Pollyfill. Alternatively, if you'd be interested in submitting a branch doing so I would be more than happy to review the results there as well. |
Hello,
Working with Angular 16, I met the following error :
I had to expose in the global scope manually the reference to the Buffer class. But, like it is mentioned in the suggestion from the official documentation, maybe, it would be preferable to set an explicit reference of this class when it is used ?
The official documentation : https://nodejs.org/api/buffer.html#buffer
"While the Buffer class is available within the global scope, it is still recommended to explicitly reference it via an import or require statement."
Desired solution
Explicit import of Buffer when it is required (like in Codecs.ts).
import { Buffer } from 'node:buffer';
The text was updated successfully, but these errors were encountered: