Recently I get in trouble with iconv-lite and vite bundler and find out vite silently remove StringDecoder polyfill.
Without StringDecoder, iconv-lite doesn't work any more. So I try to replace StringDecoder with TextDecoder. TextDecoder is a standard es module and be available since node 11.
But the code is not completely move to TextDecoder. hex/base64/binary will depend on Buffer. And if TextDecoder is not available, it will be fallback to StringDecoder.
I don't know whether it's ok to move to TextDecoder. There are some performance difference between TextDecoder and StringDecoder.
Recently I get in trouble with
iconv-lite
andvite
bundler and find outvite
silently removeStringDecoder
polyfill.Without
StringDecoder
, iconv-lite doesn't work any more. So I try to replaceStringDecoder
withTextDecoder
. TextDecoder is a standard es module and be available since node 11.But the code is not completely move to
TextDecoder
.hex
/base64
/binary
will depend onBuffer
. And ifTextDecoder
is not available, it will be fallback toStringDecoder
.I don't know whether it's ok to move to
TextDecoder
. There are some performance difference betweenTextDecoder
andStringDecoder
.