taylorhakes/promise-polyfill

Auto polyfill

yangg opened this issue · 2 comments

yangg commented

Hi, would like auto polyfill it, just like github/fetch,
then we can only add an entry to webpack

NekR commented

Or just write a bit of a wrapper if you really need that.

polyfills.js

import Promise from 'promise-polyfill';  
window.Promise = window.Promise || Promise;

Then add it to entry before your main entrypoint in your webpack config:

  entry: {
    main: [
      "./js/polyfills.js",
      "./js/main.js",
    ]
  },