ThreeJS模块未被Babel编译

问题描述 投票:0回答:1

我使用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模块?非常感谢

我使用Three.js作为模块,使用Babel编译代码,并使用WebPack打包。问题是,即使所有其他代码都已正确转译,three.js模块也没有,并且仍然包含...

javascript ecmascript-6 three.js babel transpiler
1个回答
0
投票

这对我有用:

© www.soinside.com 2019 - 2024. All rights reserved.