Skip to content

Commit 9261b82

Browse files
authored
Enable New Chunking Behavior (#9731)
* Enable New Chunking Behavior * fix tst * Increase sizes in test * add another test * Fix preloading order * Replace commons with framework
1 parent a3925b5 commit 9261b82

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

packages/next/next-server/server/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const defaultConfig: { [key: string]: any } = {
4444
),
4545
css: false,
4646
documentMiddleware: false,
47-
granularChunks: false,
47+
granularChunks: true,
4848
modern: false,
4949
plugins: false,
5050
profiling: false,

test/integration/build-output/test/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Build Output', () => {
2525
expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
2626
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
2727
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
28-
expect(stdout).toMatch(/ chunks\/commons\.js [ 0-9. ]* kB/)
28+
expect(stdout).toMatch(/ chunks\/framework\.js [ 0-9. ]* kB/)
2929

3030
expect(stdout).not.toContain('/_document')
3131
expect(stdout).not.toContain('/_app')
@@ -51,7 +51,7 @@ describe('Build Output', () => {
5151
expect(stdout).toMatch(/\/_app [ ]* \d{1,} B/)
5252
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
5353
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
54-
expect(stdout).toMatch(/ chunks\/commons\.js [ 0-9. ]* kB/)
54+
expect(stdout).toMatch(/ chunks\/framework\.js [ 0-9. ]* kB/)
5555

5656
expect(stdout).not.toContain('/_document')
5757
expect(stdout).not.toContain('/_error')
@@ -78,7 +78,7 @@ describe('Build Output', () => {
7878
expect(stdout).toMatch(/\/hybrid [ 0-9.]* B/)
7979
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
8080
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
81-
expect(stdout).toMatch(/ chunks\/commons\.js [ 0-9. ]* kB/)
81+
expect(stdout).toMatch(/ chunks\/framework\.js [ 0-9. ]* kB/)
8282

8383
expect(stdout).not.toContain('/_document')
8484
expect(stdout).not.toContain('/_error')
@@ -103,7 +103,7 @@ describe('Build Output', () => {
103103
expect(stdout).toMatch(/λ \/_error [ ]* \d{1,} B/)
104104
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
105105
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
106-
expect(stdout).toMatch(/ chunks\/commons\.js [ 0-9. ]* kB/)
106+
expect(stdout).toMatch(/ chunks\/framework\.js [ 0-9. ]* kB/)
107107

108108
expect(stdout).not.toContain('/_document')
109109
expect(stdout).not.toContain('/_app')

test/integration/preload-viewport/pages/multi-prefetch.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export default () => {
88
router.prefetch('/dynamic/[hello]')
99
router.prefetch('/dynamic/[hello]')
1010
router.prefetch('/dynamic/[hello]')
11+
12+
router.prefetch('/dynamic/first')
13+
router.prefetch('/dynamic/first')
14+
router.prefetch('/dynamic/first')
1115
}, [router])
1216
return (
1317
<div>

test/integration/size-limit/test/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('Production response size', () => {
8181
)
8282

8383
// These numbers are without gzip compression!
84-
const delta = responseSizeKilobytes - 230
84+
const delta = responseSizeKilobytes - 234
8585
expect(delta).toBeLessThanOrEqual(0) // don't increase size
8686
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
8787
})
@@ -101,7 +101,7 @@ describe('Production response size', () => {
101101
)
102102

103103
// These numbers are without gzip compression!
104-
const delta = responseSizeKilobytes - 197
104+
const delta = responseSizeKilobytes - 202
105105
expect(delta).toBeLessThanOrEqual(0) // don't increase size
106106
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
107107
})

0 commit comments

Comments
 (0)