-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Allow to convert (some of) ES6 code to ES5. #8287
Allow to convert (some of) ES6 code to ES5. #8287
Conversation
gulpfile.js
Outdated
options: { | ||
presets: ['es2015'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm completely mistaken, this will cause all build targets to output ES5 compatible code. For e.g. GENERIC
builds that makes sense, but for e.g. FIREFOX
or MOZCENTRAL
I think it'd be nice if we would be able to keep the code as ES6.
Could we perhaps utilize the PDFJS_NEXT
build flag, and only add this es2015
preset when PDFJS_NEXT === false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, is there a preset for somewhat stable stuff implemented by Firefox and Chrome? We can raise this as an issue later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, is there a preset for somewhat stable stuff implemented by Firefox and Chrome?
I don't know if there's a preset, but based on http://kangax.github.io/compat-table/es6/ it seems that the stable versions of both Firefox and Chrome already support most (if not all) of the ES6 features.
So, I cannot imagine that we'd run into too much trouble if we simply add a PDFJS_NEXT
check in this patch.
085efdd
to
5855c0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks a lot!
Allow to convert (some of) ES6 code to ES5.
Currently webpack and lib publishing does not convert ES6 code to the legacy ECMAScript. This will fix it.
glyphlist and unicode are too complex for babel -- ignoring them for now. We can keep them as commonjs modules