-
-
Notifications
You must be signed in to change notification settings - Fork 295
Open
Description
When importing iconv-lite (v0.6.2) in an Angular 10 app I'm getting this error:
Uncaught ReferenceError: global is not defined
at Object../node_modules/buffer/index.js (my-component.js:238)
at __webpack_require__ (runtime.js:85)
at Object../node_modules/safer-buffer/safer.js (my-component.js:8266)
at __webpack_require__ (runtime.js:85)
at Object../node_modules/iconv-lite/lib/index.js (my-component.js:7768)
at __webpack_require__ (runtime.js:85)
at Module../src/my-component.ts (my-component.js:11618)
at __webpack_require__ (runtime.js:85)
at Object.1 (my-component.js:11705)
at __webpack_require__ (runtime.js:85)It looks like the error comes from the dependency safer-buffer, but whilst it gets fixed, a workaround for this is adding this line in index.js:
// node_modules/iconv-lite/lib/index.js
window.global = window; // Add this just before importaing safer-buffer
var Buffer = require("safer-buffer").Buffer;Metadata
Metadata
Assignees
Labels
No labels