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
Runs the following loaders in a worker pool
npm install thread-loader
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,124 Stars
118 Commits
69 Forks
14 Watching
5 Branches
37 Contributors
Updated on 24 Nov 2024
Minified
Minified + Gzipped
JavaScript (99.48%)
SCSS (0.3%)
Less (0.08%)
CSS (0.08%)
TypeScript (0.07%)
Cumulative downloads
Total Downloads
Last day
-5.2%
295,416
Compared to previous day
Last week
2.2%
1,495,336
Compared to previous week
Last month
29.7%
6,350,497
Compared to previous month
Last year
-18.7%
66,890,029
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
14 commit(s) and 15 issue activity found in the last 90 days -- score normalized to 10
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 15/27 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
9 existing vulnerabilities detected
Details
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
Score
Last Scanned on 2024-11-18
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