问题产生
three.js开发中 使用web worker 引入外部对象和第三方库 开发时没有问题 打包后出现报错导致web worker无法使用

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://hongbin.xyz:3000/static/js/951.7b705045.chunk.js' failed to load.

Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at
在这里插入图片描述
原因 引用了第三方库
在这里插入图片描述

解决
从creata-ract-app迁移到了next.js莫名奇妙解决了 可能是打包的工作不同 CRA的 webpack在开发阶段时可以正常的. next似乎使用了 SWC 来处理

在这里插入图片描述

Logo

一站式 AI 云服务平台

更多推荐