1. 首页
  2. three.js

three.jsString.replace不是一个函数3.module.js内分解功能

three.jsn我将画布传递给webGLRenderer时出现此错误。n这是我的index.js包含Gl类:nimport * as THREE from \”three\”;import { OrbitControls } from \”three/examples/jsm/controls/OrbitControls\”;import vertexShader from \”./vertex.glsl\”;import fragmentShader from \”./fragment.glsl\”;import img from \”../assets/img/bg-image.jpg\”;class Gl = = = new THREE.Mesh(this.geometry, this.material);this.scene.add(this.mesh);}addEvents() {window.requestAnimationFrame(this.run.bind(this));window.addEventListener(\”resize\”, this.onResize.bind(this), false);}run() = w / h;this.camera.updateProjectionMatrix();this.renderer.setSize(w, h);}}export default Gl;n和内部>nerrer766×357 15.7kb由Mugen87在post#2中解决,此运行时错误可能发生,因为应用程序中的vertexShader和fragmentShader变量不存在字符串。n由于应用程序中的vertexShader和fragmentShader变量不是字符串,因此可能会发生此运行时错误。n非常感谢您n String.replace is not a function at three.module.js inside resolveIncludes funtionn

three.jsString.replace不是一个函数3.module.js内分解功能 为WP2原创文章,链接:https://www.wp2.cn/three-js/three-jsstring-replace%e4%b8%8d%e6%98%af%e4%b8%80%e4%b8%aa%e5%87%bd%e6%95%b03-module-js%e5%86%85%e5%88%86%e8%a7%a3%e5%8a%9f%e8%83%bd/