Gathering detailed insights and metrics for thread-loader
Gathering detailed insights and metrics for thread-loader
Gathering detailed insights and metrics for thread-loader
Gathering detailed insights and metrics for thread-loader
npm install thread-loader
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (99.48%)
SCSS (0.3%)
Less (0.08%)
CSS (0.08%)
TypeScript (0.07%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,130 Stars
124 Commits
70 Forks
13 Watchers
5 Branches
37 Contributors
Updated on Jul 08, 2025
Latest Version
4.0.4
Package Id
thread-loader@4.0.4
Unpacked Size
50.97 kB
Size
13.26 kB
File Count
12
NPM Version
8.5.5
Node Version
16.15.0
Published on
Sep 18, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
33
Runs the following loaders in a worker pool.
1npm install --save-dev thread-loader
or
1yarn add -D thread-loader
or
1pnpm add -D thread-loader
Put this loader in front of other loaders. The following loaders run in a worker pool.
Loaders running in a worker pool are limited. Examples:
Each worker is a separate node.js process, which has an overhead of ~600ms. There is also an overhead of inter-process communication.
Use this loader only for expensive operations!
webpack.config.js
1module.exports = { 2 module: { 3 rules: [ 4 { 5 test: /\.js$/, 6 include: path.resolve('src'), 7 use: [ 8 'thread-loader', 9 // your expensive loader (e.g babel-loader) 10 ], 11 }, 12 ], 13 }, 14};
with options
1use: [ 2 { 3 loader: 'thread-loader', 4 // loaders with equal options will share worker pools 5 options: { 6 // the number of spawned workers, defaults to (number of cpus - 1) or 7 // fallback to 1 when require('os').cpus() is undefined 8 workers: 2, 9 10 // number of jobs a worker processes in parallel 11 // defaults to 20 12 workerParallelJobs: 50, 13 14 // additional node.js arguments 15 workerNodeArgs: ['--max-old-space-size=1024'], 16 17 // Allow to respawn a dead worker pool 18 // respawning slows down the entire compilation 19 // and should be set to false for development 20 poolRespawn: false, 21 22 // timeout for killing the worker processes when idle 23 // defaults to 500 (ms) 24 // can be set to Infinity for watching builds to keep workers alive 25 poolTimeout: 2000, 26 27 // number of jobs the poll distributes to the workers 28 // defaults to 200 29 // decrease of less efficient but more fair distribution 30 poolParallelJobs: 50, 31 32 // name of the pool 33 // can be used to create different pools with elsewise identical options 34 name: 'my-pool', 35 }, 36 }, 37 // your expensive loader (e.g babel-loader) 38];
prewarming
To prevent the high delay when booting workers it possible to warmup the worker pool.
This boots the max number of workers in the pool and loads specified modules into the node.js module cache.
1const threadLoader = require('thread-loader'); 2 3threadLoader.warmup( 4 { 5 // pool options, like passed to loader options 6 // must match loader options to boot the correct pool 7 }, 8 [ 9 // modules to load 10 // can be any module, i. e. 11 'babel-loader', 12 'babel-preset-es2015', 13 'sass-loader', 14 ], 15);
Please take a moment to read our contributing guidelines if you haven't yet done so.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 16/27 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More