adambisek / string-pixel-width

Blazingly fast measure string width in pixels on the server in Javascript (Node.Js)
https://medium.com/@adambisek/text-pixel-width-measuring-on-javascript-backend-node-js-2b82bea97fab#.8ypyiffyw
MIT License
102 stars 40 forks source link

Export as ES5 module #5

Closed acailly closed 7 years ago

acailly commented 7 years ago

Today many build config does not support ES6 modules because it uses an old version of Uglify.

This is the case for create-react-app (see here)

Until uglify-es use spreads (see here), would it be possible to distribute this lib as an ES5 module ?

adambisek commented 7 years ago

Yes, it is, because published version is always compiled to ES5. When you install it via npm i string-pixel-width --save, it will work with ES5.

acailly commented 7 years ago

Actually only ES6 missing features of Node v6 are compiled because it uses es2015-node6/object-rest preset. This means this lib can't be used un the browser.

adambisek commented 7 years ago

Ohh, sorry, didn't realize that. Which preset exactly would help you?

acailly commented 7 years ago

The preset es2015 should contains all es6 features

adambisek commented 7 years ago

Version 1.2.0 is out. Should work for you now :)

acailly commented 7 years ago

It works! Thank you.