ES6 syntax in compiled build breaks compatibility with older browsers #106
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It looks like some of the more recent changes to this library have introduced the use of the
constkeyword e.g. the in newswitchElementsAltmethod:b98e3ef914/lib/switches.js (L23)While this is not an issue of itself, the npm prepublish script doesn't include a transpiling step, meaning that these
constkeywords are still present in the compiledpjax.jsbuild artifact.To fix this and continue using ES6 syntax, the prepublish step could use Babel in conjunction with Browserify. Alternatively, the 3 instances of
constin use could be replaced withvarkeywords.You're right, that's a bug. While it would be great to use ES6, a big part of Pjax is being compatible with older browsers, and I don't think it's makes sense to add extra tooling at this point.
You can submit a PR, or I'll fix it when I have a chance.
@BehindTheMath I agree that it seems like a lot of effort to add extra tooling to transpile 3 keywords, so I will submit a PR for you. I'm currently using the library in a project I'm developing and was very pleased to see your efforts in working towards pushing out a new version on npm -- I'm very happy to do anything I can to help move that along 😄