Skip to content

Commit

Permalink
Enable New Chunking Behavior (#9731)
Browse files Browse the repository at this point in the history
* Enable New Chunking Behavior

* fix tst

* Increase sizes in test

* add another test

* Fix preloading order

* Replace commons with framework
  • Loading branch information
Timer committed Jan 3, 2020
1 parent a3925b5 commit 9261b82
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/next/next-server/server/config.ts
Expand Up @@ -44,7 +44,7 @@ const defaultConfig: { [key: string]: any } = {
),
css: false,
documentMiddleware: false,
granularChunks: false,
granularChunks: true,
modern: false,
plugins: false,
profiling: false,
Expand Down
8 changes: 4 additions & 4 deletions test/integration/build-output/test/index.test.js
Expand Up @@ -25,7 +25,7 @@ describe('Build Output', () => {
expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
expect(stdout).toMatch(/ runtime\/main\.js [ 0-9.]* kB/)
expect(stdout).toMatch(/ chunks\/commons\.js [ 0-9. ]* kB/)
expect(stdout).toMatch(/ chunks\/framework\.js [ 0-9. ]* kB/)

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

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

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

expect(stdout).not.toContain('/_document')
expect(stdout).not.toContain('/_app')
Expand Down
4 changes: 4 additions & 0 deletions test/integration/preload-viewport/pages/multi-prefetch.js
Expand Up @@ -8,6 +8,10 @@ export default () => {
router.prefetch('/dynamic/[hello]')
router.prefetch('/dynamic/[hello]')
router.prefetch('/dynamic/[hello]')

router.prefetch('/dynamic/first')
router.prefetch('/dynamic/first')
router.prefetch('/dynamic/first')
}, [router])
return (
<div>
Expand Down
4 changes: 2 additions & 2 deletions test/integration/size-limit/test/index.test.js
Expand Up @@ -81,7 +81,7 @@ describe('Production response size', () => {
)

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

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

0 comments on commit 9261b82

Please sign in to comment.