Closed ajorkowski closed 4 years ago
Twillio is using Node JS native util
package.
The issue here is that prior to v5 webpack used to include browser polyfills for Node JS modules - with version 5 this behaviour has ben removed. To fix this issue just install the util
package from NPM:
npm i util
Another note is that Twillio is also accessing the "global" process
variable which has also been removed with webpack v5 release. To fix that install the process
package from NPM
npm i process
and add a new plugin to your webpack config
{
...
plugins: [
...
new webpack.ProvidePlugin({ process: 'process' }),
]
}
More info here https://webpack.js.org/blog/2020-10-10-webpack-5-release/#changes-to-the-structure
Ok, great, thanks for confirming those two things. I will use this workaround though wouldn't it be better if these weren't dependencies in the long run?
@ajorkowski This should be solved once the SDK dependency @twilio/webrtc
moves to es6. Hopefully we will work on it soon. In the meantime, please use the workarounds suggested by @LaurynasGr .
Thanks,
Manjesh
We're hitting this issue with Next.js
and twilio-video
too. But unfortunately the workarounds mentioned by @LaurynasGr aren't working for us. Has any process been made with @twilio/webrtc
being moved to ES6?
Issues are resolved if we revert to Webpack4, but using Webpack5 solves a host of other unrelated issues for our project.
I'm having the same problem now attempting to upgrade to Angular 12 which uses WebPack 5 now.
This fixed the main build
npm i -S util
Adding the code below to polyfills.ts
fixed ng test
(window as any).global = window;
(window as any).process = {
env: { DEBUG: undefined },
};
I really wish this was updated and worked out of the box with no node polyfils
Echoing @niemyjski above - it would be great for Twilio to fix this issue - having to manage polyfills for integration here is really frustrating just to get the out of the box software working - I've talked with Twilio support and they've been mostly unhelpful - this is a missed opportunity for Twilio business, please fix the 2.1.0 Javascript SDK
This is being tracked by an internal task now. (VIDEO-8609)
@LaurynasGr solution worked for me after I updated a create-react-app
project.
Hi folks,
Happy to announce that the latest release 2.21.1 fixes this issue. Please give it a spin and let us know if you're still seeing any issues!
Thank you for all of your patience, Joyce
process is not defined if I import connect in an electron app.
I don't think this was fixed
Hi @talksik,
Please check the most recent release. You may be facing the same issue as this which has now been resolved.
Best, Joyce
thank you for the prompt reply but I'm getting the same error. going to try integrating daily.co or agora
Code to reproduce the issue:
Expected behavior: Should not cause a compilation error in webpack 5. The underlying problem is that the chrome.js file is importing 'utils' which is a node.js core module and webpack is not including these anymore. Ideally there wouldn't be a utils import, but I guess I can work around this...
Actual behavior: