webpack-contrib/worker-loader được TopGit xếp vào nhóm dự án mã nguồn mở, với 1.5k sao trên GitHub, viết chủ yếu bằng JavaScript. A webpack loader that registers a script as a Web Worker
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Type: String|Function
Default: based on output.publicPath
The publicPath specifies the public URL address of the output files when referenced in a browser.
If not specified, the same public path used for other webpack assets is used.
Type: String|Function
Default: based on output.filename, adding worker suffix, for example - output.filename: '[name].js' value of this option will be [name].worker.js
Type: String
Default: based on output.chunkFilename, adding worker suffix, for example - output.chunkFilename: '[id].js' value of this option will be [id].worker.js
To integrate with TypeScript, you will need to define a custom module for the exports of your worker.
Loading with worker-loader!
typings/worker-loader.d.ts
declare module "worker-loader!*" {
// You need to change `Worker`, if you specified a different value for the `workerType` option
class WebpackWorker extends Worker {
constructor();
}
// Uncomment this if you set the `esModule` option to `false`
// export = WebpackWorker;
export default WebpackWorker;
}
my.worker.ts
const ctx: Worker = self as any;
// Post data to parent thread
ctx.postMessage({ foo: "foo" });
// Respond to message from parent thread
ctx.addEventListener("message", (event) => console.log(event));
Alternatively, you can omit the worker-loader! prefix passed to import statement by using the following notation.
This is useful for executing the code using a non-WebPack runtime environment
(such as Jest with workerloader-jest-transformer).
typings/worker-loader.d.ts
declare module "*.worker.ts" {
// You need to change `Worker`, if you specified a different value for the `workerType` option
class WebpackWorker extends Worker {
constructor();
}
// Uncomment this if you set the `esModule` option to `false`
// export = WebpackWorker;
export default WebpackWorker;
}
my.worker.ts
const ctx: Worker = self as any;
// Post data to parent thread
ctx.postMessage({ foo: "foo" });
// Respond to message from parent thread
ctx.addEventListener("message", (event) => console.log(event));
WebWorkers are restricted by a same-origin policy, so if your webpack assets are not being served from the same origin as your application, their download may be blocked by your browser.
This scenario can commonly occur if you are hosting your assets under a CDN domain.
Even downloads from the webpack-dev-server could be blocked.
There are two workarounds:
Firstly, you can inline the worker as a blob instead of downloading it as an external script via the inline parameter
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/webpack-contrib/worker-loader là nguồn chính thức.
webpack-contrib/worker-loader có bao nhiêu sao?
webpack-contrib/worker-loader có 1.5k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/webpack-contrib/worker-loader. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
webpack-contrib/worker-loader có phải mã nguồn mở không?
Có — webpack-contrib/worker-loader phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/webpack-contrib/worker-loader.
webpack-contrib/worker-loader còn đang phát triển không?
Commit gần nhất trên webpack-contrib/worker-loader là 5.0 năm trước (theo timestamp GitHub). Repo có 275 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
webpack-contrib/worker-loader là gì?
webpack-contrib/worker-loader (webpack-contrib/worker-loader) là dự án JavaScript trên GitHub. Theo mô tả gốc: A webpack loader that registers a script as a Web Worker
Đọc đầy đủ README ở tab phía trên.
worker-loader có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về worker-loader.