coolaj86 / TextEncoderLite_tmp

Polyfill for the Encoding Living Standard's API
Apache License 2.0
30 stars 19 forks source link

fix: CommonJS export, minifies JS correctly #14

Closed nenadvicentic closed 5 years ago

nenadvicentic commented 6 years ago
  1. Both TextEncoderLite and TextDecoderLite are not exported correctly (CommonJS style) component

  2. UglifyJS added as dev dependency.

  3. npm run minify command minifies latest text-encoder-lite.js to text-encoder-lite.min.js

chris13524 commented 5 years ago

Is this ever going to get merged? This is preventing the ability to encode in NodeJS.

coolaj86 commented 5 years ago

This is for the browser.

Node already handles text encoding with Buffer.

What's the use case where Buffer isn't sufficient?

chris13524 commented 5 years ago

@solderjs sorry, it's Angular so uses require() and whatnot. Webpack, I guess.

But still, the current implementation of the modules published to NPM is broken and doesn't work.

nenadvicentic commented 5 years ago

This is for the browser.

Node already handles text encoding with Buffer.

What's the use case where Buffer isn't sufficient?

Similar to @chris13524, I run into issues trying to use TextEncoderLite in the browser with module loader. I also fixed minification logic, so that minified files are in sync with source-code. My use-case is single-page-app build with Aurelia+RequireJS, but Angular works in very similar way.

@solderjs I am using my forked version over a year now in multiple projects, without any issues, so I don't see a reason not to merge this pull request back to the source repository.