# What if I just want babel/polyfill?

**URL:** <https://forum.kirupa.com/t/what-if-i-just-want-babel-polyfill/633881>\
**Category:** web dev\
**Created:** [October 24, 2015, 7:42am UTC](https://forum.kirupa.com/t/what-if-i-just-want-babel-polyfill/633881 "2015-10-24T07:42:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [October 24, 2015, 7:42am UTC](https://forum.kirupa.com/t/what-if-i-just-want-babel-polyfill/633881/1 "2015-10-24T07:42:05Z")

</div>

One weird deployment issue with ES6+Babel I’ve been wondering about is the polyfill dependency. If you were fine having `babel` or `babel-core` as a non-dev-dependency, it’d be easy to just `import 'babel/polyfill'`. The problem is that those are big dependencies, like 25MB or so.

You’d think there’d just be an npm package that’s `babel-polyfill`, which would include regenerator and corejs, but I haven’t found exactly that yet. Any ideas? npm’s `babel-es6-polyfill` is apparently meant only for browsers. So far I’ve taken to including `babel-polyfill` as a dependency that can’t be managed easily by npm or git.

* * *

As an example, imagine you have test.es6:

```javascript
function* foo(){}

```

`babel -o test.js test.es6` will give you this as test.js:

```javascript
"use strict";

var marked0$0 = [foo].map(regeneratorRuntime.mark);
function foo() {
  return regeneratorRuntime.wrap(function foo$(context$1$0) {
    while (1) switch (context$1$0.prev = context$1$0.next) {
      case 0:
      case "end":
        return context$1$0.stop();
    }
  }, marked0$0[0], this);
}

```

You’d think there’d be an npm package that wouldn’t include Babel’s compiler, but would include the requisite polyfill stuff. `babel-polyfill` is some subfolder within `babel`, so I don’t think you can get it on its own very easily.

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [October 24, 2015, 11:41am UTC](https://forum.kirupa.com/t/what-if-i-just-want-babel-polyfill/633881/2 "2015-10-24T11:41:34Z")

</div>

That does seem like it would make sense to have that separate. I’m a little surprised its not. Sounds like a feature request.

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [October 24, 2015, 10:22pm UTC](https://forum.kirupa.com/t/what-if-i-just-want-babel-polyfill/633881/3 "2015-10-24T22:22:21Z")

</div>

The fact that it’s not makes me wonder what everyone else’s build/deploy step looks like for that part. For client-side stuff, I think webpack (or similar) handles that step in my code via `babel-loader`.
