[英]Webpack babel transpile to es5 doesn't quite work
I'm trying to build my ES7 source code into a single file and have it transpiled down to ES5 but when I run webpack I still notice code like this in the built bundle我正在尝试将我的 ES7 源代码构建到一个文件中并将其转换为 ES5,但是当我运行 webpack 时,我仍然注意到构建包中的这样的代码
t.exports=class extends n(0).Component{title(){return this.constructor.name}}}
The export of the class means that something is not quite working, this is my relevant webpack config类的导出意味着有些东西不太正常,这是我相关的 webpack 配置
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["env"]
}
}
},
What am I doing wrong?我究竟做错了什么?
为了节省其他人我浪费的宝贵的几个小时 - 我包含了包含来自 node_modules 的 ES5+ 代码的库,而且很明显,配置忽略了 node_modues,所以我只需要删除该行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.