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) {
16
16
}
17
17
18
18
module . exports = ( api , options ) => {
19
- const useThreads = process . env . NODE_ENV === 'production' && options . parallel
19
+ const useThreads = process . env . NODE_ENV === 'production' && ! ! options . parallel
20
20
const cliServicePath = require ( 'path' ) . dirname ( require . resolve ( '@vue/cli-service' ) )
21
21
const transpileDepRegex = genTranspileDepRegex ( options . transpileDependencies )
22
22
@@ -59,9 +59,13 @@ module.exports = (api, options) => {
59
59
. end ( )
60
60
61
61
if ( useThreads ) {
62
- jsRule
62
+ const threadLoaderConfig = jsRule
63
63
. use ( 'thread-loader' )
64
64
. loader ( 'thread-loader' )
65
+
66
+ if ( typeof options . parallel === 'number' ) {
67
+ threadLoaderConfig . options ( { workers : options . parallel } )
68
+ }
65
69
}
66
70
67
71
jsRule
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ const path = require('path')
2
2
3
3
module . exports = ( api , options ) => {
4
4
const fs = require ( 'fs' )
5
- const useThreads = process . env . NODE_ENV === 'production' && options . parallel
5
+ const useThreads = process . env . NODE_ENV === 'production' && ! ! options . parallel
6
6
7
7
api . chainWebpack ( config => {
8
8
config . resolveLoader . modules . prepend ( path . join ( __dirname , 'node_modules' ) )
@@ -37,7 +37,11 @@ module.exports = (api, options) => {
37
37
38
38
if ( useThreads ) {
39
39
addLoader ( {
40
- loader : 'thread-loader'
40
+ loader : 'thread-loader' ,
41
+ options :
42
+ typeof options . parallel === 'number'
43
+ ? { workers : options . parallel }
44
+ : { }
41
45
} )
42
46
}
43
47
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ const schema = createSchema(joi => joi.object({
10
10
runtimeCompiler : joi . boolean ( ) ,
11
11
transpileDependencies : joi . array ( ) ,
12
12
productionSourceMap : joi . boolean ( ) ,
13
- parallel : joi . boolean ( ) ,
13
+ parallel : joi . alternatives ( ) . try ( [
14
+ joi . boolean ( ) ,
15
+ joi . number ( ) . integer ( )
16
+ ] ) ,
14
17
devServer : joi . object ( ) ,
15
18
pages : joi . object ( ) . pattern (
16
19
/ \w + / ,
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export interface ProjectOptions {
38
38
runtimeCompiler ?: boolean ;
39
39
transpileDependencies ?: Array < string | RegExp > ;
40
40
productionSourceMap ?: boolean ;
41
- parallel ?: boolean ;
41
+ parallel ?: boolean | number ;
42
42
devServer ?: object ;
43
43
pages ?: {
44
44
[ key : string ] : PageEntry | PageConfig ;
You can’t perform that action at this time.
0 commit comments