Skip to content

Commit

Permalink
fix: disable parallel build when extractCSS is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Feb 13, 2019
1 parent bcd672f commit aad46ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/config/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ export function getNuxtConfig(_options) {
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
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.')
Expand Down
6 changes: 6 additions & 0 deletions packages/config/test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ describe('config: options', () => {
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', () => {
test('should transform middleware to array', () => {
const { router: { middleware } } = getNuxtConfig({ router: { middleware: 'midd' } })
Expand Down

1 comment on commit aad46ed

@clarkdo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is re-commited from #5004, thank @stevefan1999-personal so much .

Please sign in to comment.