File tree 1 file changed +12
-1
lines changed
packages/@vue/cli-service/lib
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,17 @@ exports.validate = (options, cb) => {
47
47
validate ( options , schema , cb )
48
48
}
49
49
50
+ // #2110
51
+ // https://github.com/nodejs/node/issues/19022
52
+ // in some cases cpus() returns undefined, and may simply throw in the future
53
+ function hasMultipleCores ( ) {
54
+ try {
55
+ return require ( 'os' ) . cpus ( ) . length > 1
56
+ } catch ( e ) {
57
+ return false
58
+ }
59
+ }
60
+
50
61
exports . defaults = ( ) => ( {
51
62
// project deployment base
52
63
baseUrl : '/' ,
@@ -74,7 +85,7 @@ exports.defaults = () => ({
74
85
75
86
// use thread-loader for babel & TS in production build
76
87
// enabled by default if the machine has more than 1 cores
77
- parallel : require ( 'os' ) . cpus ( ) . length > 1 ,
88
+ parallel : hasMultipleCores ( ) ,
78
89
79
90
// multi-page config
80
91
pages : undefined ,
You can’t perform that action at this time.
0 commit comments