使用Webpack输出es6? [英] Use Webpack to output es6?

查看:152
本文介绍了使用Webpack输出es6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种使用Webpack捆绑所有JavaScript文件并将结果bundle.js输出为es6文件而不是es5的方法?因此,捆绑是Webpack的工作,但转换为es6实际上是Webpack的工作吗?还是某些Webpack加载程序的工作?还是我必须为此使用babel?

解决方案

Webpack仍然无法做到这一点. 这里有一张公开票 https://github.com/webpack/webpack/issues/2933

现在,如果您想捆绑es6,最有前途的解决方案似乎是汇总

本文也链接到GitHub上的讨论中,并提供了很好的概述

https://medium.com/webpack/webpack-and-rollup-same-but-different-a41ad427058c

Is there a way to use Webpack to bundle all the JavaScript files and output the resulting bundle.js as an es6 file, and not to es5? So, it is Webpack's job to bundle, but is it actually Webpack's job to convert to es6? Or is that the job of some Webpack loader? Or would I have to use babel for that?

解决方案

Webpack still can't do this. There is an open ticket here https://github.com/webpack/webpack/issues/2933

For now, if you want to bundle es6 the most promising solution seems to be rollup

This article is also linked in the discussion on GitHub and provides a pretty good overview

https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c

这篇关于使用Webpack输出es6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆