You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
webpack 5 issue: process.nextTick is undefined #450
Getting an error with webpack 5 since process.nextTick isn't being polyfilled automatically.
_stream_writable.js?5bc2:459 Uncaught ReferenceError: process is not defined
at onwrite (_stream_writable.js?5bc2:459)
at WritableState.onwrite (_stream_writable.js?5bc2:160)
at module.exports.ClientRequest._write (request.js?925e:262)
at doWrite (_stream_writable.js?5bc2:409)
at writeOrBuffer (_stream_writable.js?5bc2:398)
at module.exports.Writable.write (_stream_writable.js?5bc2:307)
Would the answer be to polyfill this manually? If yes - might be useful to add to documentation.
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.
I see. After posting my comment i found #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.
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.
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
Activity
benjamingr commentedon Oct 29, 2020
In the meantime yes. Though I think readable-stream can probably use enqueueMicrotask (that is available in browsers as well)
markg85 commentedon Oct 30, 2020
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?
mcollina commentedon Oct 30, 2020
This library does not support Webpack 5. It runs in browsers with browserify and Webpack 4.
benjamingr commentedon Oct 30, 2020
@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
markg85 commentedon Oct 30, 2020
I see. After posting my comment i found #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.
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?
benjamingr commentedon Oct 30, 2020
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.
markg85 commentedon Oct 30, 2020
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 :)
kelly-tock commentedon Dec 29, 2020
The solutions mentioned above are still not working for me.
foliojs/pdfkit#1195
For more information.
kelly-tock commentedon Jan 5, 2021
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
kelly-tock commentedon Jan 5, 2021
also, some success with process polyfill for pdfkit:
foliojs/pdfkit#1195
mcollina commentedon May 23, 2022
Will be fixed in v4.0.0