Nwb: Add option to disable polyfills?

Created on 14 Jan 2017  路  2Comments  路  Source: insin/nwb

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 馃憤

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-polyfill to exclude them, or create a config file and use polyfill config.

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ivanasetiawan picture ivanasetiawan  路  5Comments

lachlanjc picture lachlanjc  路  3Comments

empz picture empz  路  4Comments

insin picture insin  路  5Comments

clayrisser picture clayrisser  路  3Comments