reqwest
reqwest copied to clipboard
Fix unsafe of "this" inside module initialization (TypeError: Cannot use 'in' operator to search for 'window' in undefined)
when using esbuild with vite. this file generates an exception.
TypeError: Cannot use 'in' operator to search for 'window' in undefined
at reqwest.js:15
at reqwest.js:8
at ../node_modules/reqwest/reqwest.js (reqwest.js:10)
at __require2 (chunk-RDZ5XA5N.js?v=dde87764:17)
at ../node_modules/auth0-js/index.js (index.js:14)
at __require2 (chunk-RDZ5XA5N.js?v=dde87764:17)
at dep:auth0-js:1
this is how it looks like when compiled with esbuild+vite. "this" is now referencing a different context than the intended window.
using global this will make it more robust. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
I got the same problem, seems the author is not maintaining...
you can try use the forked version we've published few years ago https://www.npmjs.com/package/reqwest-logz
you can try use the forked version we've published few years ago https://www.npmjs.com/package/reqwest-logz
it works! thanks!