config: use local machine's cpu count for default concurrency value

pull/3386/head
Yuxuan Zhang 2 years ago
parent 9281648b3e
commit f9f968499a
No known key found for this signature in database
GPG Key ID: 6910B04F3351EF7D

@ -19,6 +19,7 @@ import {
type SiteData type SiteData
} from './shared' } from './shared'
import type { RawConfigExports, SiteConfig, UserConfig } from './siteConfig' import type { RawConfigExports, SiteConfig, UserConfig } from './siteConfig'
import { cpus } from 'os'
export { resolvePages } from './plugins/dynamicRoutesPlugin' export { resolvePages } from './plugins/dynamicRoutesPlugin'
export * from './siteConfig' export * from './siteConfig'
@ -142,7 +143,11 @@ export async function resolveConfig(
rewrites, rewrites,
userConfig, userConfig,
sitemap: userConfig.sitemap, sitemap: userConfig.sitemap,
buildConcurrency: userConfig.buildConcurrency ?? 64 buildConcurrency: Math.max(
userConfig.buildConcurrency ?? cpus().length,
1 // At least one thread required
),
multithreadRender: userConfig.multithreadRender ?? false
} }
// to be shared with content loaders // to be shared with content loaders

Loading…
Cancel
Save