From 29d178942bd3da1d1d1b32d0993b6d34269e8dd2 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Tue, 10 Dec 2019 14:53:44 -0500 Subject: [PATCH 1/2] Enable New Chunking for CSS --- packages/next/next-server/server/config.ts | 7 ++++++- test/integration/css/next.config.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/next/next-server/server/config.ts b/packages/next/next-server/server/config.ts index 34ca86e763d7c..f537c5fb21cd7 100644 --- a/packages/next/next-server/server/config.ts +++ b/packages/next/next-server/server/config.ts @@ -99,7 +99,12 @@ function assignDefaults(userConfig: { [key: string]: any }) { } }) - return { ...defaultConfig, ...userConfig } + const result = { ...defaultConfig, ...userConfig } + if (result.experimental && result.experimental.css) { + // The new CSS support requires granular chunks be enabled. + result.experimental.granularChunks = true + } + return result } function normalizeConfig(phase: string, config: any) { diff --git a/test/integration/css/next.config.js b/test/integration/css/next.config.js index 38da3cd3360b3..164fc7439acf6 100644 --- a/test/integration/css/next.config.js +++ b/test/integration/css/next.config.js @@ -3,7 +3,7 @@ module.exports = { // Make sure entries are not getting disposed. maxInactiveAge: 1000 * 60 * 60, }, - experimental: { css: true, granularChunks: true }, + experimental: { css: true }, webpack(cfg) { cfg.devtool = 'source-map' return cfg From 47027a7dfa778720931eac8409ce510bf3d04bf4 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Tue, 10 Dec 2019 14:55:52 -0500 Subject: [PATCH 2/2] set false --- test/integration/css/next.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/css/next.config.js b/test/integration/css/next.config.js index 164fc7439acf6..a00d484fdec00 100644 --- a/test/integration/css/next.config.js +++ b/test/integration/css/next.config.js @@ -3,7 +3,11 @@ module.exports = { // Make sure entries are not getting disposed. maxInactiveAge: 1000 * 60 * 60, }, - experimental: { css: true }, + experimental: { + css: true, + // Intentionally set false to ensure we force to true. + granularChunks: false, + }, webpack(cfg) { cfg.devtool = 'source-map' return cfg