Replies: 3 comments
-
https://github.com/web-infra-dev/rslib/tree/main/tests/integration/worker You can see this test case as an example. |
Beta Was this translation helpful? Give feedback.
-
你的测试代码代码分了两个entry分别构建,index里面使用的是js结尾的文件 但是构建的这个包的产物在不同的工具上表现各不相同 在rsbuild上能正常工作,但是在vite上无法正常加载 构建后的代码为
但是实际上,vite在加载这个包的时候会编译为
然后会发起一个这样的请求 |
Beta Was this translation helpful? Give feedback.
-
这个是一个vite的问题,需要将worker加入到 optimizeDeps.exclude |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My goal is to build a package that will call a worker.
I can't build a worker file.
by the way
vite will build
new URL("./a.worker.js", import.meta.url)
intonew URL(/* @vite-ignore */ "/node_modules/.vite/deps/a.worker.js?worker_file&type=classic", import.meta.url)
Vite is trying to find the file .vite/deps/a.worker.js, and apparently it can't find it.
This will lead to an even greater difficulty in finding the correct path. I hope it is under myPackage/xx.worker.js
how to use
xx.worker.ts?worker&inline
in rslib?Beta Was this translation helpful? Give feedback.
All reactions