thekevinscott / emoji-tree

46 stars 10 forks source link

Remove ES6 arrow function for building with UglifyJS. #1

Closed daveschumaker closed 7 years ago

daveschumaker commented 7 years ago

When importing this library into a project using create-react-app, I end up getting the following error when running npm run build:

static/js/main.4b40bb14.js from UglifyJs
Unexpected token: operator (>) [./~/emoji-tree/lib/parse.js:5,0][static/js/main.4b40bb14.js:18284,32]

It looks like it's related to an issue that the UglifyJS library (which currently ships with create-react-app) has with building modules that use ES6.

Hopefully this will be fixed inside UglifyJS in the near future (though this was reported as an issue back in 2015 and it's still not fixed!). I love using ES6 myself, but it seems like the recommended approach is that we still need to transpile npm modules to ES5 for maximum compatibility.

thekevinscott commented 7 years ago

Thanks for the PR, this looks great.