fix: disable parallel build when extractCSS is enabled

This commit is contained in:
Clark Du 2019-02-13 10:32:13 +00:00
parent bcd672f931
commit aad46ed674
2 changed files with 12 additions and 0 deletions

View File

@ -281,6 +281,12 @@ export function getNuxtConfig(_options) {
consola.warn('vendor has been deprecated due to webpack4 optimization') consola.warn('vendor has been deprecated due to webpack4 optimization')
} }
// Disable CSS extraction due to incompatibility with thread-loader
if (options.build && options.build.extractCSS && options.build.parallel) {
options.build.parallel = false
consola.warn('extractCSS cannot work with parallel build due to limited work pool in thread-loader')
}
// build.extractCSS.allChunks has no effect // build.extractCSS.allChunks has no effect
if (typeof options.build.extractCSS.allChunks !== 'undefined') { if (typeof options.build.extractCSS.allChunks !== 'undefined') {
consola.warn('build.extractCSS.allChunks has no effect from v2.0.0. Please use build.optimization.splitChunks settings instead.') consola.warn('build.extractCSS.allChunks has no effect from v2.0.0. Please use build.optimization.splitChunks settings instead.')

View File

@ -105,6 +105,12 @@ describe('config: options', () => {
expect(fallback).toEqual('404.html') expect(fallback).toEqual('404.html')
}) })
test('should disable parallel if extractCSS is enabled', () => {
const { build: { parallel } } = getNuxtConfig({ build: { extractCSS: true, parallel: true } })
expect(parallel).toEqual(false)
expect(consola.warn).toHaveBeenCalledWith('extractCSS cannot work with parallel build due to limited work pool in thread-loader')
})
describe('config: router dir', () => { describe('config: router dir', () => {
test('should transform middleware to array', () => { test('should transform middleware to array', () => {
const { router: { middleware } } = getNuxtConfig({ router: { middleware: 'midd' } }) const { router: { middleware } } = getNuxtConfig({ router: { middleware: 'midd' } })