Unverified Commit 9261b82a authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

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
parent a3925b58
...@@ -44,7 +44,7 @@ const defaultConfig: { [key: string]: any } = { ...@@ -44,7 +44,7 @@ const defaultConfig: { [key: string]: any } = {
), ),
css: false, css: false,
documentMiddleware: false, documentMiddleware: false,
granularChunks: false, granularChunks: true,
modern: false, modern: false,
plugins: false, plugins: false,
profiling: false, profiling: false,
......
...@@ -25,7 +25,7 @@ describe('Build Output', () => { ...@@ -25,7 +25,7 @@ describe('Build Output', () => {
expect(stdout).toMatch(/\/ [ ]* \d{1,} B/) expect(stdout).toMatch(/\/ [ ]* \d{1,} B/)
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/) expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
expect(stdout).toMatch(/ runtime\/main\.js [ 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('/_document')
expect(stdout).not.toContain('/_app') expect(stdout).not.toContain('/_app')
...@@ -51,7 +51,7 @@ describe('Build Output', () => { ...@@ -51,7 +51,7 @@ describe('Build Output', () => {
expect(stdout).toMatch(/\/_app [ ]* \d{1,} B/) expect(stdout).toMatch(/\/_app [ ]* \d{1,} B/)
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/) expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
expect(stdout).toMatch(/ runtime\/main\.js [ 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('/_document')
expect(stdout).not.toContain('/_error') expect(stdout).not.toContain('/_error')
...@@ -78,7 +78,7 @@ describe('Build Output', () => { ...@@ -78,7 +78,7 @@ describe('Build Output', () => {
expect(stdout).toMatch(/\/hybrid [ 0-9.]* B/) expect(stdout).toMatch(/\/hybrid [ 0-9.]* B/)
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/) expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
expect(stdout).toMatch(/ runtime\/main\.js [ 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('/_document')
expect(stdout).not.toContain('/_error') expect(stdout).not.toContain('/_error')
...@@ -103,7 +103,7 @@ describe('Build Output', () => { ...@@ -103,7 +103,7 @@ describe('Build Output', () => {
expect(stdout).toMatch(/λ \/_error [ ]* \d{1,} B/) expect(stdout).toMatch(/λ \/_error [ ]* \d{1,} B/)
expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/) expect(stdout).toMatch(/\+ shared by all [ 0-9.]* kB/)
expect(stdout).toMatch(/ runtime\/main\.js [ 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('/_document')
expect(stdout).not.toContain('/_app') expect(stdout).not.toContain('/_app')
......
...@@ -8,6 +8,10 @@ export default () => { ...@@ -8,6 +8,10 @@ export default () => {
router.prefetch('/dynamic/[hello]') router.prefetch('/dynamic/[hello]')
router.prefetch('/dynamic/[hello]') 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]) }, [router])
return ( return (
<div> <div>
......
...@@ -81,7 +81,7 @@ describe('Production response size', () => { ...@@ -81,7 +81,7 @@ describe('Production response size', () => {
) )
// These numbers are without gzip compression! // These numbers are without gzip compression!
const delta = responseSizeKilobytes - 230 const delta = responseSizeKilobytes - 234
expect(delta).toBeLessThanOrEqual(0) // don't increase size expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
}) })
...@@ -101,7 +101,7 @@ describe('Production response size', () => { ...@@ -101,7 +101,7 @@ describe('Production response size', () => {
) )
// These numbers are without gzip compression! // These numbers are without gzip compression!
const delta = responseSizeKilobytes - 197 const delta = responseSizeKilobytes - 202
expect(delta).toBeLessThanOrEqual(0) // don't increase size expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
}) })
......
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