As an open-source project, webpack-contrib/worker-loader has picked up 1.5k stars on GitHub (JavaScript). A webpack loader that registers a script as a Web Worker
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
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
How active is development on webpack-contrib/worker-loader?
The most recent commit recorded on webpack-contrib/worker-loader was 4.9 years ago, based on the GitHub push timestamp. The repository has 275 forks — one of the better signals of community interest.
How many stars does webpack-contrib/worker-loader have?
webpack-contrib/worker-loader has 1.5k GitHub stars — refresh the page for the live number, or check github.com/webpack-contrib/worker-loader. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is webpack-contrib/worker-loader open source?
Yes — webpack-contrib/worker-loader ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/webpack-contrib/worker-loader.
What is webpack-contrib/worker-loader?
webpack-contrib/worker-loader (webpack-contrib/worker-loader) is a JavaScript project on GitHub. From the project's own README: A webpack loader that registers a script as a Web Worker
Where do I read more about webpack-contrib/worker-loader?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/webpack-contrib/worker-loader is the definitive source.
Read full README in the tab above.
Want a second opinion on worker-loader?
Ask an AI that can read this page — one click and you get its take on worker-loader.