Hacker News new | ask | show | jobs
by hzoo 3471 days ago
Might be a good chance to suggest using our new preset: https://github.com/babel/babel-preset-env/.

TL;DR - automate your Babel config options based on targets.

babel-preset-env: A Babel preset that can automatically determine the Babel plugins and polyfills you need based on your supported environments.

It takes the data from compat-table [1] to generate a mapping [2] between a Babel plugin and the first version that a browser/env supports. We calculate the least common denominator of your targeted envs to determine the final set of plugins to compile with.

(Feel free to ask questions, I help maintain Babel and the preset). Just released a 1.0 a few weeks ago and looking for more help and usage! Looking into more help with removing unnecessary polyfills, and determining plugins based on performance via benchmarks of native/compiled.

And yes there is a lot of work that goes into making this work correctly (and in the foreseeable future with ES2015+). Would appreciate any help moving forward. And maybe we should just replace/recommend this preset instead of anything else to fight the fatigue..

[1]: https://kangax.github.io/compat-table/es6/ [2]: https://github.com/babel/babel-preset-env/blob/master/data/p...