Update to `[email protected]`
fix https://github.com/aadsm/jschardet/issues/97
👋 We (VS Code) are in the process of moving to ESM (https://github.com/microsoft/vscode/pull/166033) and are running into an issue when loading jschardet.min.js into our node.js environment. The error was no longer reproducible when moving to a newer version of google-closure-compiler, in fact even just the next version v20151216 fixes it.
The error we see is when attempting to load jschardet.min.js with a custom loader we implement to bridge between ESM and CommonJS/AMD. The error is:
TypeError: Cannot read properties of undefined (reading 'iterator')
at $jscomp.initSymbolIterator (evalmachine.<anonymous>:1:384)
at $jscomp.makeIterator (evalmachine.<anonymous>:2:42)
at evalmachine.<anonymous>:164:334
at new c (evalmachine.<anonymous>:164:465)
at evalmachine.<anonymous>:662:132
at 42../constants (evalmachine.<anonymous>:662:395)
There is more context in https://github.com/microsoft/vscode/issues/160416#issuecomment-2211276269 and onward.
I think with newer versions of google-closure-compiler some polyfills are no longer applied that maybe lead to this issue 🤔
Curious why this project has never updated this dependency to a later version. With this PR the latest version is picked and obviously the change in jschardet.min.js is rather large. Is there a way to validate this works in all environments?
I was able to distill a minimal repro in https://github.com/aadsm/jschardet/issues/97
@aadsm friendly ping 👋
Oh wow, I really missed this issue, thanks for pinging. I was actually working on this sometime ago but then other things came up.
It is now available as [email protected].
Thanks a bunch!