Best way to include babel-polyfill?

This may help a bit.

The goal was to avoid import of babel-polyfill from my source code as well as I was trying to avoid:

  entry: {
    pageA: ['babel-polyfill', './pagea'],
    pageB: ['babel-polyfill', './pageb'],
   ...
  },

Finally I’m using:

  entry: {
    vendor: 'babel-polyfill',
    pageA: './pagea',
    pageB: './pageb',
  },

Not sure it is best solution, but at least best I found. I was also trying to replace babel-polyfill by transform-runtime, but it doesn’t work for me.

Let me note that in both cases the vendor is auto-created by:

new webpack.optimize.CommonsChunkPlugin({
  name: "vendor",
  minChunks: function (module) {
    // all imports from the node_modules directory are bundled into vendor
    return module.context && module.context.indexOf('node_modules') !== -1;
  },
}),