【发布时间】:2020-06-01 04:37:21
【问题描述】:
我使用 Three.js 作为模块,使用 Babel 编译代码,使用 WebPack 打包。问题是即使所有其他代码都被正确编译,three.js 模块没有并且仍然包含 ES6 语法。这会导致 IE11 出现问题。
.babelrc
{
"presets": [
[
"@babel/preset-env" , {
"targets": {
"ie": "11"
}
}]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-classes"
]
}
webpack.config
module: {
rules: [
{
test: /\.js$/,
//exclude: /node_modules/,
loaders: ['babel-loader']
},
...
这里我注释掉了 node_module 文件夹,但即使这样,问题仍然存在
知道什么是错的以及如何获得转译的 Threejs 模块吗?非常感谢
【问题讨论】:
标签: javascript ecmascript-6 three.js babeljs transpiler