jsonwebtoken is a Node.js module, its use in a browser was never intended. Versions before 9.0.0 could use webpack's polyfill of the Node.js built-in modules. ....It is better to rely on JWT modules made to be consumed in browser environments. You can discover such modules on jwt.io under "JavaScript" libraries.
As stated in https://github.com/auth0/node-jsonwebtoken/issues/863,
There are now issues with versions < 9.x
A potential replacement is something like jose