{"id":32490047,"url":"https://github.com/webpack/thread-loader","last_synced_at":"2026-01-12T01:03:16.926Z","repository":{"id":20348227,"uuid":"89708127","full_name":"webpack/thread-loader","owner":"webpack","description":"Runs the following loaders in a worker pool","archived":false,"fork":false,"pushed_at":"2025-10-24T18:55:18.000Z","size":1504,"stargazers_count":1130,"open_issues_count":16,"forks_count":69,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-11-05T07:07:50.680Z","etag":null,"topics":["loader","multithreading","thread","webpack","webpack-loader","worker-pool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpack.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"webpack"}},"created_at":"2017-04-28T13:22:39.000Z","updated_at":"2025-11-03T16:52:19.000Z","dependencies_parsed_at":"2024-02-07T11:29:47.934Z","dependency_job_id":"928682d9-da69-481c-ac41-764b0f7700fa","html_url":"https://github.com/webpack/thread-loader","commit_stats":{"total_commits":116,"total_committers":26,"mean_commits":4.461538461538462,"dds":0.7413793103448276,"last_synced_commit":"8abc6aae85553f037a3340616da8110aad2500e9"},"previous_names":["webpack-contrib/thread-loader"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/webpack/thread-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack%2Fthread-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack%2Fthread-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack%2Fthread-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack%2Fthread-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpack","download_url":"https://codeload.github.com/webpack/thread-loader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack%2Fthread-loader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["loader","multithreading","thread","webpack","webpack-loader","worker-pool"],"created_at":"2025-10-27T08:19:41.085Z","updated_at":"2026-01-12T01:03:16.921Z","avatar_url":"https://github.com/webpack.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://webpack.js.org/\"\u003e\n    \u003cimg width=\"200\" height=\"200\" hspace=\"25\" src=\"https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![discussion][discussion]][discussion-url]\n[![size][size]][size-url]\n\n# thread-loader\n\nRuns the specified loaders in a worker pool.\n\n## Getting Started\n\n```bash\nnpm install --save-dev thread-loader\n```\n\nor\n\n```bash\nyarn add -D thread-loader\n```\n\nor\n\n```bash\npnpm add -D thread-loader\n```\n\nPut this loader in front of other loaders.\nThe following loaders run in a worker pool.\n\nLoaders running in a worker pool have limitations. Examples:\n\n- Loaders cannot emit files.\n- Loaders cannot use custom loader APIs (i.e. by plugins).\n- Loaders cannot access webpack options.\n\nEach worker is a separate Node.js process, which has an overhead of ~600ms. There is also additional overhead from inter-process communication.\n\n\u003e Use this loader only for expensive operations!\n\n### Examples\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        include: path.resolve('src'),\n        use: [\n          'thread-loader',\n          // your expensive loader (e.g babel-loader)\n        ],\n      },\n    ],\n  },\n};\n```\n\n**with options**\n\n```js\nuse: [\n  {\n    loader: 'thread-loader',\n    // loaders with equal options will share worker pools\n    options: {\n      // the number of spawned workers, defaults to (number of cpus - 1) or\n      // fallback to 1 when require('os').cpus() is undefined\n      workers: 2,\n\n      // number of jobs a worker processes in parallel\n      // defaults to 20\n      workerParallelJobs: 50,\n\n      // additional node.js arguments\n      workerNodeArgs: ['--max-old-space-size=1024'],\n\n      // Allow to respawn a dead worker pool\n      // respawning slows down the entire compilation\n      // and should be set to false for development\n      poolRespawn: false,\n\n      // timeout for killing the worker processes when idle\n      // defaults to 500 (ms)\n      // can be set to Infinity for watching builds to keep workers alive\n      poolTimeout: 2000,\n\n      // number of jobs the pool distributes to the workers\n      // defaults to 200\n      // decrease for less efficient but more fair distribution\n      poolParallelJobs: 50,\n\n      // name of the pool\n      // can be used to create different pools with otherwise identical options\n      name: 'my-pool',\n    },\n  },\n  // your expensive loader (e.g babel-loader)\n];\n```\n\n**prewarming**\n\nTo prevent the high delays when booting workers, it is possible to warm up the worker pool.\n\nThis boots the max number of workers in the pool and loads the specified modules into the Node.js module cache.\n\n```js\nconst threadLoader = require('thread-loader');\n\nthreadLoader.warmup(\n  {\n    // pool options, like passed to loader options\n    // must match loader options to boot the correct pool\n  },\n  [\n    // modules to load\n    // can be any module, i.e.\n    'babel-loader',\n    '@babel/preset-env',\n    'sass-loader',\n  ],\n);\n```\n\n## Contributing\n\nWe welcome all contributions!\nIf you're new here, please take a moment to review our contributing guidelines before submitting issues or pull requests.\n\n[CONTRIBUTING](https://github.com/webpack/thread-loader?tab=contributing-ov-file#contributing)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/thread-loader.svg\n[npm-url]: https://npmjs.com/package/thread-loader\n[node]: https://img.shields.io/node/v/thread-loader.svg\n[node-url]: https://nodejs.org\n[tests]: https://github.com/webpack/thread-loader/workflows/thread-loader/badge.svg\n[tests-url]: https://github.com/webpack/thread-loader/actions\n[cover]: https://codecov.io/gh/webpack/thread-loader/branch/main/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack/thread-loader\n[discussion]: https://img.shields.io/github/discussions/webpack/webpack\n[discussion-url]: https://github.com/webpack/webpack/discussions\n[size]: https://packagephobia.now.sh/badge?p=thread-loader\n[size-url]: https://packagephobia.now.sh/result?p=thread-loader\n","funding_links":["https://opencollective.com/webpack"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack%2Fthread-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpack%2Fthread-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack%2Fthread-loader/lists"}