At the moment, I have decided the following:
In the root folder of the application import / require babel-polyfill for common ES6 policies, such as Array.prototype.find, Object. appoint and promise. Since sampling is a special case, since it is considered that it is not suitable for all environments, a separate polyfill is used for whatwg-fetch .
import "babel-polyfill"; import "whatwg-fetch";
In the webpack configuration, remove all the ES6 features provided through ProvidePlugin, but leave there any other amenities (e.g. jQuery orz).
new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", // 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch', // 'Promise': 'exports?global.Promise!es6-promise', }),
This should give me more rounded ES6 support with a manual selection for every feature I use. I hope Babel 5/6 can Tree-Shake use any unused function that would otherwise cause bloat, including all babel-polyfill, maybe someone else can talk about it.
source share