我们目前正在与Next.js和Three.js (反应-三纤维)一起进行一个项目。在浏览器中清除缓存后,3d模型不再显示。我们会犯一些错误。实际上,一次警告是一个错误(多次)。错误是
Uncaught (in promise) RuntimeError: abort(TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function). Build with -s ASSERTIONS=1 for more info.我们确实使用了一些环境变量,但没有特别导入模块"env“。参数("-s ASSERTIONS=1")对我们不起作用。
控制台输出开始时出现的另一个警告是:
failed to asynchronously prepare wasm: TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function错误有时会出现,有时不会出现,我们不知道原因。
谢谢你做的一切
编辑:
"dependencies": {
"@heroicons/react": "^1.0.1",
"@next/env": "^11.1.2",
"@react-three/drei": "^2.2.13",
"@tweenjs/tween.js": "^18.6.4",
"autoprefixer": "^10.2.5",
"axios": "^0.21.1",
"drei": "^2.2.13",
"framer-motion": "^4.1.8",
"iso-3166-1": "^2.0.1",
"jwt-decode": "^3.1.2",
"moment": "^2.29.1",
"next": "^11.0.0",
"postcss": "^8.2.12",
"react": "^17.0.2",
"react-country-flag": "^2.3.0",
"react-dom": "^17.0.2",
"react-fps-stats": "^0.1.3",
"react-icons": "^4.2.0",
"react-loader-spinner": "^4.0.0",
"react-select": "^4.3.1",
"react-simple-maps": "^2.3.0",
"react-spring": "^8.0.27",
"react-three-fiber": "^5.3.11",
"react-time-ago": "^6.2.2",
"react-tooltip": "^4.2.21",
"swr": "^0.5.5",
"tailwindcss": "^2.1.1",
"three": "^0.124.0",
"use-asset": "^1.0.4"
},
"devDependencies": {
"eslint": "^7.24.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-next": "^11.0.0",
"eslint-config-prettier": "^8.2.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonarjs": "^0.6.0",
"eslint-plugin-tailwindcss": "^1.13.2",
"eslint-plugin-unicorn": "^30.0.0",
"husky": "^6.0.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1"
}发布于 2021-10-14 07:47:32
在我们的例子中,我们将draco解码器路径设置为:
https://www.gstatic.com/draco/v1/decoders/
通过呼叫:
this.dracoLoader.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");
但是他们推荐的方法是在URL中指定版本:
https://www.gstatic.com/draco/versioned/decoders/1.4.3/
他们昨天发布了一个新版本,解释了突然出现的错误:https://github.com/google/draco/releases/tag/1.4.3
更改为版本化的URL,为我们修复它。另一个有效的解决方法是使用JS而不是组件:
this.dracoLoader.setDecoderConfig({ type: "js" });
https://stackoverflow.com/questions/69554577
复制相似问题