File tree Expand file tree Collapse file tree 4 files changed +17
-6
lines changed
Expand file tree Collapse file tree 4 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function genTranspileDepRegex (transpileDependencies) {
1616}
1717
1818module . exports = ( api , options ) => {
19- const useThreads = process . env . NODE_ENV === 'production' && options . parallel
19+ const useThreads = process . env . NODE_ENV === 'production' && ! ! options . parallel
2020 const cliServicePath = require ( 'path' ) . dirname ( require . resolve ( '@vue/cli-service' ) )
2121 const transpileDepRegex = genTranspileDepRegex ( options . transpileDependencies )
2222
@@ -59,9 +59,13 @@ module.exports = (api, options) => {
5959 . end ( )
6060
6161 if ( useThreads ) {
62- jsRule
62+ const threadLoaderConfig = jsRule
6363 . use ( 'thread-loader' )
6464 . loader ( 'thread-loader' )
65+
66+ if ( typeof options . parallel === 'number' ) {
67+ threadLoaderConfig . options ( { workers : options . parallel } )
68+ }
6569 }
6670
6771 jsRule
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const path = require('path')
22
33module . exports = ( api , options ) => {
44 const fs = require ( 'fs' )
5- const useThreads = process . env . NODE_ENV === 'production' && options . parallel
5+ const useThreads = process . env . NODE_ENV === 'production' && ! ! options . parallel
66
77 api . chainWebpack ( config => {
88 config . resolveLoader . modules . prepend ( path . join ( __dirname , 'node_modules' ) )
@@ -37,7 +37,11 @@ module.exports = (api, options) => {
3737
3838 if ( useThreads ) {
3939 addLoader ( {
40- loader : 'thread-loader'
40+ loader : 'thread-loader' ,
41+ options :
42+ typeof options . parallel === 'number'
43+ ? { workers : options . parallel }
44+ : { }
4145 } )
4246 }
4347
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ const schema = createSchema(joi => joi.object({
1010 runtimeCompiler : joi . boolean ( ) ,
1111 transpileDependencies : joi . array ( ) ,
1212 productionSourceMap : joi . boolean ( ) ,
13- parallel : joi . boolean ( ) ,
13+ parallel : joi . alternatives ( ) . try ( [
14+ joi . boolean ( ) ,
15+ joi . number ( ) . integer ( )
16+ ] ) ,
1417 devServer : joi . object ( ) ,
1518 pages : joi . object ( ) . pattern (
1619 / \w + / ,
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export interface ProjectOptions {
3838 runtimeCompiler ?: boolean ;
3939 transpileDependencies ?: Array < string | RegExp > ;
4040 productionSourceMap ?: boolean ;
41- parallel ?: boolean ;
41+ parallel ?: boolean | number ;
4242 devServer ?: object ;
4343 pages ?: {
4444 [ key : string ] : PageEntry | PageConfig ;
You can’t perform that action at this time.
0 commit comments