我正在使用 vite 和 Threejs 库做我的第一个 ThreeJS 小项目
我在js文件中添加了这些灯光功能,
// emit light evenly in all directions from specific point in space
const pointLight = new Three.PointLight( 0xff0000, 1, 100 );
pointLight.position.set(5, 5, 5);
// to spread the lighting across the entire scene
const ambientLight = new Three.AmbientLight(0xffffff);
scene.add(pointLight, ambientLight);
package.json 内部,
{
"name": "three-demo",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"vite": "^5.2.0"
},
"dependencies": {
"three": "^0.128.0"
}
}
问题是照明功能可以与三个依赖项完美配合“三”:“^0.128.0”,但是当更改为最新版本“三”:“^0.164.1”并运行npm install时,则照明功能不工作