FormidableLabs / component-playground

A component for rendering React components with editable source and live preview
MIT License
1.19k stars 117 forks source link

Use babel runtime, instead of polyfill #28

Open omerts opened 9 years ago

omerts commented 9 years ago

Hello,

Babel doesn't allow loading two different version of babel/polyfill. Therefore, running a project which has this (great) library, using babel-node, or babel/register,(in a different version) causes babel to throw an error. It is also unrecommended by @sebmck (creator of babel), to inlcude a polyfill in a library (see https://github.com/babel/babel/issues/1312#issuecomment-94833770). Using the babel runtime is the recommended solution.

omerts commented 9 years ago

created pull request that fixes this: https://github.com/FormidableLabs/component-playground/pull/30

sapegin commented 9 years ago

@baer any news here?

kenwheeler commented 9 years ago

@sapegin we are just examining the internal impact of switching and we'll be pushing this out in a semver major release.

isTravis commented 8 years ago

I'm running into this too: Error: only one instance of babel-polyfill is allowed.

Is this still on the roadmap, or should just use @omerts PR?

Thanks so much for this work!

kenwheeler commented 8 years ago

Hmm. Probably shouldn't polyfill in a lib. Let me check the impact of removal on a project or two and then I'll get the polyfill removed. Looks like that PR is way out of date, so I'll do it manually.

vvo commented 8 years ago

Hi! Do you know which parts of the code actually needs a polyfill? Quickly reading the code it doesn't seems like we really need it (no Array.from or things like that found, mostly ES5 methods).

And if we really need some polyfill then ask the user to provide it OR tell them to include https://polyfill.io/v2/docs/.

Thanks for the awesome project.

omerts commented 8 years ago

@vvo code you run inside the playground needs to be polyfilled/transpilled.

You could ask the user, to take care of polyfilling/transpilling himself, but it would make this great lib a little harder to use. Also, this lib already offers es6 transpilling, so removing it is a little problematic.

omerts commented 8 years ago

If there is a need, and author's approve it will be merged, I am willing to to update the pull request to work with the latest version.

mishkinf commented 7 years ago

+1 We shouldn't be using babel polyfill. We should rather be using babel runtime for this kind of stuff.

mishkinf commented 7 years ago

@kenwheeler Any update on the status of removing the polyfill?