sql-wasm.wasm file is not getting loaded correctly when invoked as a web worker
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, next.js, sqlite, wasm
Hướng nghiên cứu
Start by running the StackBlitz reproduction and inspect worker.sql-wasm.js, next.config.js, and the reported Next.js issue. Trace the request for sql-wasm.wasm when the web worker starts; done means the worker loads the WASM file without the reported 404.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
The responding sql-wasm.wasm file requested by worker.sql-wasm.js doesn't get served correctly and thus leads to a 404 error. I am not sure if that is a bug which is native to next.js though and thus opened an issue there as well. I spend the last two to three days looking into lots of similar issues on github, but none seems to be a viable solution.
Description
I try to invoke a web-worker in one of my pages like this:
/** Add your relevant code here for the issue to reproduce */
export default function Home() {
const createDb = () => {
const worker = new Worker(
new URL('../public/assets/worker.sql-wasm.js', import.meta.url)
);
worker.onerror = (e) => console.log('Worker error: ', e);
};
return (
<>
<h1>Test</h1>
<br />
<button
onClick={() => {
createDb();
}}
>
Create DB
</button>
</>
);
}
(Please see my reproduction of the problem at Stackblitz)
When doing so I get served a 404 error as the sql-wasm.wasm file can't be find inside the build directory i.e. http://localhost:3000/_next/static/chunks/sql-wasm.wasm.
Question
Is this error due to the nature of the locateFile() function of emscripten or due to a mistake in how I configured the corresponding next.config.js file?
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
webpack: (
config,
{ buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }
) => {
if (!isServer) {
config.resolve.fallback.fs = false;
}
return config;
},
};
module.exports = config;
ANY help is much appreciated!
- Ngôn ngữ chính
- JavaScript
- Star
- 13.7k
- Fork
- 1.1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sql-js/sql.js
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Add the WebWorker API docs Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của sql-js/sql.js
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Daemon passes --experimental-wasm-jspi unconditionally on Node >= 24; Node 26 rejects the flag Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Automattic/studio#4908 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
sugarlabs/musicblocks#8847 ·