Unexpected token: name (EventDispatcher) [38.aea1d8b326caea9be210.chunk.js:677,6]

安装three.js 0.128.0版本 ,build报错

 解决:

在webpack.base.config.js中规则rules下配置

{
        test: /\.js$/,
        loader: 'happypack/loader?id=happybabel',
        // exclude: /node_modules/
        include: [resolve('../build'), resolve('../src'), resolve('../node_modules/three/build'),resolve('../node_modules/three/examples/jsm'),resolve('../static/js')]
},

在.babelrc中配置

{
    "presets": [
        "stage-3","env",
        ["es2015", {"modules": false}]
    ],
    "plugins": ["transform-runtime", "syntax-dynamic-import", "transform-vue-jsx","transform-es2015-modules-commonjs"],
    "comments": false
}
posted @ 2023-08-23 19:08  一江春水向东刘小姐  阅读(25)  评论(0编辑  收藏  举报