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

polyfill and runtime transformer documentation is lacking #491

Closed
Macil opened this issue Oct 30, 2015 · 5 comments
Closed

polyfill and runtime transformer documentation is lacking #491

Macil opened this issue Oct 30, 2015 · 5 comments

Comments

@Macil
Copy link

Macil commented Oct 30, 2015

The old page about the runtime transformer seems to have disappeared. There's a new page about the runtime transformer, but it's less than useful. The setup page doesn't seem to mention the polyfill-or-runtime-transformer requirement at all. Nothing I found seems to link to the polyfill page, and that page doesn't do much to explain its necessity. The sentence "This will emulate a full ES6 environment" almost makes it sound like one could use babel or the polyfill to get ES6, instead of explaining that babel often must be used with the polyfill (or runtime transform). Issues like babel/babel#2654 seem inevitable for new users currently.

The polyfill page ought to explain its relationship to the runtime transformer and the necessity of one or the other being used for most es2015 transforms, and other pages (mainly the setup page and/or the transformers page) should link to it.

@tschaub
Copy link

tschaub commented Nov 3, 2015

I'm also interested in knowing how someone can know when the polyfill needs to be used. I was surprised, for example, to find that the es2015 presets implement instanceof with Symbol.

$ echo 'foo instanceof Bar' | babel --presets es2015
"use strict";

function _instanceof(left, right) { if (right != null && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }

_instanceof(foo, Bar);

I had originally assumed that the es2015 preset would result in ES2015 being transformed into ES5 (to the extent possible). I'd be happy to help update the documentation if someone could add detail here on when babel-polyfill is required. I'm sure it depends on the plugins being used. I imagine it would be useful to at least document when it is required using es2015 presets.

@tschaub
Copy link

tschaub commented Nov 3, 2015

I've prosed babel/babel#2784 to make it so instanceof doesn't require a Symbol polyfill.

@dburrows
Copy link
Contributor

I agree this is an issue, I'm no longer sure when I need to use the polyfill and so I'm wary of upgrading to 6 - can't we just make a 'es2015-nopolyfill' or similar preset to make it 100% clear?

@dburrows
Copy link
Contributor

Actually, will propose that on main repo, but still agree that this needs to be documented

trodrigues added a commit to trodrigues/babel.github.io that referenced this issue Jan 11, 2016
Based on https://github.com/babel/babel.github.io/blob/862b43db93e48762671267034a50c30c00e433e2/docs/usage/runtime.md

Not sure if the documentation from Babel 5 is still 100% accurate, but from what I could understand it seems to be.

Related to babel#674 and babel#491

Also added this to the main repo at babel/babel#3258
@hzoo
Copy link
Member

hzoo commented May 6, 2016

this is done

@hzoo hzoo closed this as completed May 6, 2016
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

No branches or pull requests

4 participants