Commit 282de734 authored by Tobias Koppers's avatar Tobias Koppers Committed by Zack Tanner

disable production chunking in dev (#64488)

### What?

The production chunking plugin shouldn't be enabled in development

### Why?

It doesn't handle HMR yet


Closes PACK-2956
parent 1b931ce7
...@@ -1880,6 +1880,7 @@ export default async function getBaseWebpackConfig( ...@@ -1880,6 +1880,7 @@ export default async function getBaseWebpackConfig(
new NextFontManifestPlugin({ new NextFontManifestPlugin({
appDir, appDir,
}), }),
!dev &&
isClient && isClient &&
new CssChunkingPlugin(config.experimental.cssChunking === 'strict'), new CssChunkingPlugin(config.experimental.cssChunking === 'strict'),
!dev && !dev &&
......
import path from 'path' import path from 'path'
import { createNextDescribe, FileRef } from 'e2e-utils' import { nextTestSetup, FileRef } from 'e2e-utils'
function getPairs(all: string[]): (readonly [string, string])[] { function getPairs(all: string[]): (readonly [string, string])[] {
const result: (readonly [string, string])[] = [] const result: (readonly [string, string])[] = []
...@@ -187,10 +187,7 @@ const PAGES: Record< ...@@ -187,10 +187,7 @@ const PAGES: Record<
const allPairs = getPairs(Object.keys(PAGES)) const allPairs = getPairs(Object.keys(PAGES))
for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) const options = (mode) => ({
createNextDescribe(
`css-order ${mode}`,
{
files: { files: {
app: new FileRef(path.join(__dirname, 'app')), app: new FileRef(path.join(__dirname, 'app')),
pages: new FileRef(path.join(__dirname, 'pages')), pages: new FileRef(path.join(__dirname, 'pages')),
...@@ -207,8 +204,11 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) ...@@ -207,8 +204,11 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])
dependencies: { dependencies: {
sass: 'latest', sass: 'latest',
}, },
}, })
({ next, isNextDev }) => { describe.each(process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])(
'css-order %s',
(mode: string) => {
const { next, isNextDev } = nextTestSetup(options(mode))
for (const ordering of allPairs) { for (const ordering of allPairs) {
const name = `should load correct styles navigating back again ${ordering.join( const name = `should load correct styles navigating back again ${ordering.join(
' -> ' ' -> '
...@@ -219,13 +219,7 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) ...@@ -219,13 +219,7 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])
} }
// TODO fix this case // TODO fix this case
const broken = const broken =
mode === 'turbo' isNextDev || ordering.some((page) => PAGES[page].brokenLoading)
? isNextDev
: ordering.some(
(page) =>
PAGES[page].brokenLoading ||
(isNextDev && PAGES[page].brokenLoadingDev)
)
if (broken) { if (broken) {
it.todo(name) it.todo(name)
continue continue
...@@ -259,8 +253,15 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) ...@@ -259,8 +253,15 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])
await navigate(page) await navigate(page)
await check(PAGES[page]) await check(PAGES[page])
} }
await browser.close()
}) })
} }
}
)
describe.each(process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])(
'css-order %s',
(mode: string) => {
const { next, isNextDev } = nextTestSetup(options(mode))
for (const ordering of allPairs) { for (const ordering of allPairs) {
const name = `should load correct styles navigating ${ordering.join( const name = `should load correct styles navigating ${ordering.join(
' -> ' ' -> '
...@@ -306,8 +307,15 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) ...@@ -306,8 +307,15 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])
await navigate(page) await navigate(page)
await check(PAGES[page]) await check(PAGES[page])
} }
await browser.close()
}) })
} }
}
)
describe.each(process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])(
'css-order %s',
(mode: string) => {
const { next } = nextTestSetup(options(mode))
for (const [page, pageInfo] of Object.entries(PAGES)) { for (const [page, pageInfo] of Object.entries(PAGES)) {
const name = `should load correct styles on ${page}` const name = `should load correct styles on ${page}`
if (mode === 'loose' && pageInfo.conflict) { if (mode === 'loose' && pageInfo.conflict) {
...@@ -321,7 +329,8 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose']) ...@@ -321,7 +329,8 @@ for (const mode of process.env.TURBOPACK ? ['turbo'] : ['strict', 'loose'])
.waitForElementByCss(pageInfo.selector) .waitForElementByCss(pageInfo.selector)
.getComputedCss('color') .getComputedCss('color')
).toBe(pageInfo.color) ).toBe(pageInfo.color)
await browser.close()
}) })
} }
} }
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment