microsoft / vscode-iconv-lite-umd

A UMD version of iconv-lite to be used in VSCode.
MIT License
7 stars 7 forks source link

add umd build of iconv-lite #1

Closed gyzerok closed 4 years ago

gyzerok commented 4 years ago

Hello @bpasero!

Here is the UMD build of iconv-lite as we discussed. Currently it depends on the released 0.5.1 version, however building with master doesn't seem to provide any benefits.

The build as is results in 648KiB

            Asset     Size
iconv-lite-umd.js  648 KiB

I was able to shave ~40KiB by excluding utf7 and utf32 encodings.

            Asset     Size
iconv-lite-umd.js  605 KiB

There might be some opportunities to shave more, but I am not as well-versed in encodings topic to do that on my own without breaking something.

I will try to collaborate with the iconv-lite author to see how/if this can be reduced further.

UPDATE 1

It looks like cp949 is also not supported by VSCode. I've excluded it as well from the build.

            Asset     Size
iconv-lite-umd.js  568 KiB

UPDATE 2

Since 0.6.0 is now released, I've updated to use it. Unfortunately that increased the resulting size a bit.

            Asset     Size
iconv-lite-umd.js  583 KiB

UPDATE 3

Thanks to the author of iconv-lite, who pointed out that inline source maps contribute half of the resulting size.

                Asset     Size
    iconv-lite-umd.js  250 KiB
iconv-lite-umd.js.map  249 KiB
ghost commented 4 years ago

CLA assistant check
All CLA requirements met.

bpasero commented 4 years ago

Thanks, published this as https://www.npmjs.com/package/iconv-lite-umd

gyzerok commented 4 years ago

@bpasero did you miss my question about source maps?

bpasero commented 4 years ago

@gyzerok oh yeah I missed that. I would not want sourcemaps to be inside any of the web modules, not sure why we decided to add them for semver-umd but I can follow up and ask.

gyzerok commented 4 years ago

@bpasero great! Then once you are able to confirm they are not needed I can make PRs to both libraries to fix it.

bpasero commented 4 years ago

@gyzerok please go ahead with a new PR and I can review when I hear back 👍

What is the size difference?

gyzerok commented 4 years ago

@bpasero check “update 3” in the first post. Will supply PRs tomorrow :)

bpasero commented 4 years ago

@gyzerok ah nice!