-
Notifications
You must be signed in to change notification settings - Fork 29
NodeJS modules are needed to be polyfilled in browser builds #575
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
Comments
Thanks for the report. Just to be sure have you tried it with the latest patch |
Yes |
@mattiaz9 I was exploring your issue and it seems that unfortunately, this is a problem of ViteJS because it does not handle correctly I am afraid there is nothing we can do on our side until this is resolved. |
Do you actually need nodejs modules in the browser? Shimming node packages is a bad practice anyway, and many bundlers (if not all), stopped injecting them automatically. If the 3.2 version works I assume this practice wasn't used before and probably isn't needed, at least for the browser version of this package. |
Bee-js aims to be a platform agnostic library, which internally uses browser-first APIs so most of the polyfilling is actually happening on Node's side, but still, there needs to be differentiation on how the data are handled/processed in browser and node as different APIs are available across these environments. For this to happen there is nowadays a pretty standardized approach using The reason why this issue has surfaced now is that we have changed how we bundle bee-js, where historically we have bundled all the files for all environments (including Node) using webpack, which then handled all this for you, but also bundles all the dependencies and everything else into one big file, which does not really make sense as it prevents for bee-js users to utilize their bundlers to do proper optimizations around dependencies de-duplication, tree shaking etc and generally does not make sense for Node environment, so we have dropped that and we now uses simple One thing you could try to do is to use instead of our |
@mattiaz9 the issue in Vite was fixed so in the next release please test it ;-) |
@AuHau I tried with the last 2 versions
|
Hmm, well it seems like others reports still the problem existing: vitejs/vite#7576 (comment) Lets see how it evolves... |
I believe this has been fixed as a side effect of several refactors since then. This can be tested by running |
When I try to start my react application it gives me this error:
I'm using Vitejs with typescript BTW, so I'm not shimming node dependencies.
The text was updated successfully, but these errors were encountered: