mathiasbynens / jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
https://mths.be/jsesc
MIT License
716 stars 53 forks source link

Make default source files es5 compatible #44

Open 256dpi opened 5 years ago

256dpi commented 5 years ago

I had some troubles using this library in a project using parcel. The issue was that the jsesc code base uses some es6 syntax, but does not transpile the code. Most tools assume that code linked from the main field in package.json point to source code that uses only es5 syntax. There are attempts to use other fields to point to es6 modules. However, for that to work, the code base first needs to be fully migrated to es6 syntax and used es modules e.g. import and export syntax.

This PR fixes the issue temporarily by transpiling the current code base to es5 using babel.

mathiasbynens commented 5 years ago

Did you see https://github.com/mathiasbynens/jsesc#support? Is using jsesc@1.3.0 not an option for you?

256dpi commented 5 years ago

I saw the notice. I also do not use the library anymore myself. Just wanted to help going forward with using es6 while still supporting es5 environments.