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

Allow to convert (some of) ES6 code to ES5. #8287

Merged
merged 1 commit into from
Apr 14, 2017

Conversation

yurydelendik
Copy link
Contributor

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

gulpfile.js Outdated
options: {
presets: ['es2015'],
Copy link
Collaborator

@Snuffleupagus Snuffleupagus Apr 14, 2017

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a 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!

@Snuffleupagus Snuffleupagus merged commit fd51a7c into mozilla:master Apr 14, 2017
@yurydelendik yurydelendik deleted the babel-es2015-preset branch April 14, 2017 21:15
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Allow to convert (some of) ES6 code to ES5.
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

Successfully merging this pull request may close these issues.

2 participants