A little Preact demo built with preact build foo.js might not need them. Out of curiosity - would you be open to using something like ProvidePlugin to import them only if needed?
new webpack.ProvidePlugin({
'Promise': 'promise-polyfill',
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
})
Also - in terms of the size of the polyfills VS code, maybe choosing slimmer versions might help out there too. I spent a while experimenting with a number of different polyfills and I found promise-polyfill is the smallest (1.2kb versus the 2.2kb for promise). I'm sitting on a fetch polyfill (just haven't had time to formally release it) that is 1.1kb rather than the 2.6kb for whatwg-fetch, not sure if that's useful either. It'd be neat to have an option to disable polyfills so that I could import my own 馃憤
Oh, I didn't know about ProvidePlugin, would rather only include them when needed like that, always up for slimming the current ones down if possible too.
For now you can use --no-polyfill to exclude them, or create a config file and use polyfill config.
Sweet! I should have caught that in the docs!
Most helpful comment
Oh, I didn't know about
ProvidePlugin, would rather only include them when needed like that, always up for slimming the current ones down if possible too.For now you can use
--no-polyfillto exclude them, or create a config file and usepolyfillconfig.