Firefox工人中的ECMAScript模块,但有时只能起作用吗? (comlink)
我有点困惑,我想我只是让自己更困惑。
firefox显然不支持 ecmascript模块,但是我正在开始工作。表现不一致。我有一个使用ComLink和ES6模块的项目。当我用Firefox运行它时,它似乎可以正常工作。
...直到昨天,我们在Firefox 100上有一个客户,他正在获取DatacLoneError:无法克隆该对象。
。我在众多设备上安装了许多版本的Firefox,但我似乎无法重新创建问题。我让客户重置他们的浏览器,但没有运气修复它。
我的comlink工人就是这样:
import { FetchFromId } from "./deobf";
export const Fetch = async (id: string): Promise<CustomObject | Error> => {
return FetchFromId(id);
};
称为这样:(
import { FetchFromId } from "./deobf";
if (window.Worker) {
WORKER = new ComlinkWorker<typeof import('./worker')>(new URL('./worker', import.meta.url), { type: "module" });
}
const res = await (WORKER ? WORKER.Fetch(id) : FetchFromId(id)); // DataCloneError: The object could not be cloned
comlinkworker
来自在这里)
当我在Firefox 100中运行此操作时,是否应该因为不支持它而丢下错误?
I'm a bit confused, and I think I'm just confusing myself more.
Firefox apparently does not support ECMAScript modules inside Workers, however I'm getting inconsistent performance with it. I have a project that uses Comlink and ES6 modules. When I ran it in Firefox, it seemed to work fine.
... Until yesterday, we had a client on Firefox 100 who's getting DataCloneError: The object could not be cloned.
. I've installed numerous versions of Firefox on numerous devices, and I can't seem to recreate the issue. I had the client reset their browser, but no luck fixing it.
My Comlink worker is something like this:
import { FetchFromId } from "./deobf";
export const Fetch = async (id: string): Promise<CustomObject | Error> => {
return FetchFromId(id);
};
And it's called like this:
import { FetchFromId } from "./deobf";
if (window.Worker) {
WORKER = new ComlinkWorker<typeof import('./worker')>(new URL('./worker', import.meta.url), { type: "module" });
}
const res = await (WORKER ? WORKER.Fetch(id) : FetchFromId(id)); // DataCloneError: The object could not be cloned
(ComlinkWorker
is from here)
When I run this in Firefox 100, should it not throw an error because it's not supported?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论