如何将 ES6 转换为 ES5 而不会在浏览器中产生膨胀?

How to transpile ES6 to ES5 without bloat for production in the browser?

是否有可用的转译器 configuration/option 转译 ES6,例如for-of-loops 到 ES5 哪个真的可以在生产网站上使用?我发现最好的是包含一个额外的 polyfill,这会导致 vanilla ES5 中相同功能的文件大小至少翻倍。或者这个转译器的想法是只为 nodejs 编写未来的 esnext 吗?

具体谈谈 Babel,如果你想减少负载大小,你可以坚持不使用 require polyfilling and you may be interested in the runtime transformer for consolidating helper code. You could try to squeeze out a bit more with optional transformers like minification.deadCodeElimination and minification.constantFolding 的功能,但我认为你无论如何都在缩小你的代码,这可能已经做了一些.