Closed pbadenski closed 2 years ago
Would the answer be to polyfill this manually? If yes - might be useful to add to documentation.
In the meantime yes. Though I think readable-stream can probably use enqueueMicrotask (that is available in browsers as well)
I have this very same issue! After a few hours of debugging, and using this library because it claims to be browser compatible, i ended up here about to report a bug. This library uses process.nextTick which you don't have in a browser.
I am surprised to find that - when doing git blame - process.nextTick is already used for at least a year! How come nobody ever had an issue with it thus far?
Note, i too am using webpack 5. If anyone has an intermediate solution, i'm all ears! How do you manually and properly polyfill it?
This library does not support Webpack 5. It runs in browsers with browserify and Webpack 4.
@markg85 fwiw you can jut tell Webpack 5 to polyfill process APIs - it's just setting up an alias. I can't find official docs but here: https://medium.com/@sanchit3b/how-to-polyfill-node-core-modules-in-webpack-5-905c1f5504a0
This library does not support Webpack 5. It runs in browsers with browserify and Webpack 4.
I see. After posting my comment i found https://github.com/nodejs/readable-stream/pull/435 which explains why it doesn't work. I'm beginning to build up a big hatred against webpack :P I don't like it, i don't want to use it.. It just seemed to be the most logical thing to use when making something in node.js and wanting to run it in the browser. In this specific case i want to run a libp2p experiment in the browser.
While i do get the webpack point of view of not supporting node object injections like process, it is a sore pain in the *** that the package world isn't ready yet for their (idealistic?) views.
To be honest, it's probably time for me to look for an alternative to webpack. I don't want or need to be looking for solutions for hours. I just want nodejs app compile to website compatible and be done with it. Webpack used to be an ok-ish fit for that. Not anymore it seems.
@markg85 fwiw you can jut tell Webpack 5 to polyfill process APIs - it's just setting up an alias. I can't find official docs but here: https://medium.com/@sanchit3b/how-to-polyfill-node-core-modules-in-webpack-5-905c1f5504a0
I found that one too. I find these examples to be severely biased towards people who know all the ins and outs of webpack already and know enough by reading one line. I'm apparently not one of those. Do you have an actual example of what i should be putting in the webpack config file and/or package.json?
Do you have an actual example of what i should be putting in the webpack config file and/or package.json?
No since I haven't updated to webpack 5 myself. After the webpack 3->4 upgrade fiasco I've resigned to wait 6 months before attempting to upgrade. I'd just use webpack 4 and wait if I were you.
Do you have an actual example of what i should be putting in the webpack config file and/or package.json?
No since I haven't updated to webpack 5 myself. After the webpack 3->4 upgrade fiasco I've resigned to wait 6 months before attempting to upgrade. I'd just use webpack 4 and wait if I were you.
So parcel works like a charm without any issue at all! Which makes me wonder, why the hell do i keep torturing myself with webpack if there is something (way) better out there.
Guess i'm a parcel user now :)
The solutions mentioned above are still not working for me.
https://github.com/foliojs/pdfkit/issues/1195
For more information.
also, just for anyone that ends up here, here's a list from webpack of the modules that are used in v4, was more clear to me at least than the medium article: https://github.com/webpack/node-libs-browser
also, some success with process polyfill for pdfkit: https://github.com/foliojs/pdfkit/issues/1195
Will be fixed in v4.0.0
Getting an error with webpack 5 since process.nextTick isn't being polyfilled automatically.
Would the answer be to polyfill this manually? If yes - might be useful to add to documentation.