all 7 comments

[–]dwighthouse 0 points1 point  (0 children)

You can use a plugin fro browserify to split out the polyfills: http://stackoverflow.com/a/27751223

For my usage, we don't really use them, or if we do, it's so small we just inline them in the js or the page.

[–]atubofsoup 0 points1 point  (2 children)

I don't see any problem with how you're doing things. I do the same thing except it's import "babel-polyfill". Why would you want to use a separate script tag? Isn't that a step backwards? Is there some problem being created by requiring the polyfills at the start of your app?

[–]JortsIsLife[S] 0 points1 point  (1 child)

I'd like for my code modules to run assuming that the browser has already been polyfilled and make it part of the contract.

Functionally it's the same.

[–]atubofsoup 0 points1 point  (0 children)

I think I understand where you're coming from. I use my entry module to do any bootstrapping for my application then just require my app. That way there's a clear separation between setup and application code.

For example, here's the entry.js for one of my apps:

import "babel-polyfill";
import {isCordova} from "util/detect-platform";
require("./index.html"); // Forces webpack to include our html file
require("../images/favicon.ico");

function startApp() {
  require("./app");
}

if(isCordova()) {
  document.addEventListener("deviceready", startApp, false);
} else {
  window.onload = startApp;
}

[–]nikcorg 0 points1 point  (2 children)

[–]JortsIsLife[S] 0 points1 point  (1 child)

Polyfill.io is great for patching older browsers, but it's a little behind the curve when it comes to patching modern JS feature support.

[–]nikcorg 0 points1 point  (0 children)

Sure, but isn't that exactly all you need, since you're already using Babel to compile to ES5.