Webpack babel 转译到 es5 不太有效
Webpack babel transpile to es5 doesn't quite work
我正在尝试将我的 ES7 源代码构建到一个文件中并将其转换为 ES5,但是当我 运行 webpack 时,我仍然注意到构建的包中有这样的代码
t.exports=class extends n(0).Component{title(){return this.constructor.name}}}
class 的导出意味着有些东西不太好用,这是我相关的 webpack 配置
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["env"]
}
}
},
我做错了什么?
为了节省其他人我浪费的宝贵的几个小时 - 我包括了包含来自 node_modules 的 ES5+ 代码的库,并且很明显配置忽略了 node_modues,所以我只需删除该行。
我正在尝试将我的 ES7 源代码构建到一个文件中并将其转换为 ES5,但是当我 运行 webpack 时,我仍然注意到构建的包中有这样的代码
t.exports=class extends n(0).Component{title(){return this.constructor.name}}}
class 的导出意味着有些东西不太好用,这是我相关的 webpack 配置
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["env"]
}
}
},
我做错了什么?
为了节省其他人我浪费的宝贵的几个小时 - 我包括了包含来自 node_modules 的 ES5+ 代码的库,并且很明显配置忽略了 node_modues,所以我只需删除该行。