File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/@vue/cli-service/lib Expand file tree Collapse file tree 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) => {
4747 validate ( options , schema , cb )
4848}
4949
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+
5061exports . defaults = ( ) => ( {
5162 // project deployment base
5263 baseUrl : '/' ,
@@ -74,7 +85,7 @@ exports.defaults = () => ({
7485
7586 // use thread-loader for babel & TS in production build
7687 // enabled by default if the machine has more than 1 cores
77- parallel : require ( 'os' ) . cpus ( ) . length > 1 ,
88+ parallel : hasMultipleCores ( ) ,
7889
7990 // multi-page config
8091 pages : undefined ,
You can’t perform that action at this time.
0 commit comments