three.js报错依赖,原因:three版本过高

vue版本

"devDependencies":{
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.9.1",
    "webpack-merge": "^4.1.0"
}
"dependencies":{
    "vue": "^2.5.2",
}

1、安装three.js

npm i three@0.128.0

版本如果过高,就会报错,如下: 安装0.128.0版本的three.js就可以解决

ERROR  Failed to compile with 1 errors                                                                                       
error  in ./node_modules/three/build/three.module.js
Module parse failed: Unexpected token (2583:25)
You may need an appropriate loader to handle this file type.
|
|               this.texture = source.texture.clone();
|               this.texture.image = { ...this.texture.image }; // See #20328.
|
|               this.depthBuffer = source.depthBuffer;

 @ ./src/view/Home/index.js 1:0-31

 

posted @ 2023-07-26 15:50  一江春水向东刘小姐  阅读(857)  评论(0编辑  收藏  举报