我正在使用webpack和babel,尝试使箭头函数在Internet Explorer中起作用,但我无法让它起作用。
这是我的package.json开发依赖:
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.7.0",
"webpack": "^3.12.0",
"webpack-cli": "^3.1.0"
}
这是我的webpack.config.js文件:
module.exports = {
entry: ['./chat.js'],
devtool: 'source-map',
output: {
path: path.resolve(__dirname, "dist"),
filename: "chat.js"
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
};
我正在使用带有.babelrc的插件:
{
"presets": ["env"],
"plugins": ["transform-class-properties"]
}
我不知道我做错了什么或者是否遗漏了什么,但我在Internet Explorer上收到以下语法错误:
DF.fn = () => {
// Content
};