Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export as ES5 module #5

Closed
acailly opened this issue Sep 8, 2017 · 6 comments
Closed

Export as ES5 module #5

acailly opened this issue Sep 8, 2017 · 6 comments

Comments

@acailly
Copy link

acailly commented Sep 8, 2017

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
Copy link
Owner

adambisek commented Sep 8, 2017

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
Copy link
Author

acailly commented Sep 8, 2017

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
Copy link
Owner

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

@acailly
Copy link
Author

acailly commented Sep 8, 2017

The preset es2015 should contains all es6 features

@adambisek
Copy link
Owner

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

@acailly
Copy link
Author

acailly commented Sep 12, 2017

It works! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants