next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Avoid extra asset generation for the SSR middleware

Open shuding opened this issue 3 years ago • 6 comments

Currently we are generating extra JS assets like build-manifest.js for the SSR middleware to consume. This PR removes it with directly importing those manifests. This is also needed by #31971, to remove special processes between the 2 runtimes.

Bug

  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added
  • [ ] Errors have helpful link attached, see contributing.md

Feature

  • [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • [ ] Related issues linked using fixes #number
  • [ ] Integration tests added
  • [ ] Documentation added
  • [ ] Telemetry added. In case of a feature if it's used or not.
  • [ ] Errors have helpful link attached, see contributing.md

Documentation / Examples

  • [ ] Make sure the linting passes by running yarn lint

shuding avatar Dec 01 '21 19:12 shuding

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 17.2s 17.3s ⚠️ +70ms
buildDurationCached 3.2s 3.2s ⚠️ +69ms
nodeModulesSize 347 MB 347 MB -1.54 kB
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 2.766 2.699 -0.07
/ avg req/sec 903.86 926.4 +22.54
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.158 1.138 -0.02
/error-in-render avg req/sec 2158.5 2196.72 +38.22
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 28.4 kB 28.4 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 72.3 kB 72.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.37 kB 1.37 kB
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 326 B 326 B
dynamic-HASH.js gzip 2.38 kB 2.38 kB
head-HASH.js gzip 350 B 350 B
hooks-HASH.js gzip 635 B 635 B
image-HASH.js gzip 4.49 kB 4.49 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 1.87 kB 1.87 kB
routerDirect..HASH.js gzip 321 B 321 B
script-HASH.js gzip 383 B 383 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 13.3 kB 13.3 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 460 B 460 B
Overall change 460 B 460 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 532 B 532 B
link.html gzip 545 B 545 B
withRouter.html gzip 527 B 527 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 19s 18.9s -77ms
buildDurationCached 3.3s 3.4s ⚠️ +146ms
nodeModulesSize 347 MB 347 MB -1.54 kB
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 2.778 2.726 -0.05
/ avg req/sec 899.82 917.16 +17.34
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.176 1.167 -0.01
/error-in-render avg req/sec 2125.82 2142.55 +16.73
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.3 kB 42.3 kB
main-HASH.js gzip 28.6 kB 28.6 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 72.5 kB 72.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 305 B 305 B
css-HASH.js gzip 321 B 321 B
dynamic-HASH.js gzip 2.37 kB 2.37 kB
head-HASH.js gzip 342 B 342 B
hooks-HASH.js gzip 622 B 622 B
image-HASH.js gzip 4.53 kB 4.53 kB
index-HASH.js gzip 256 B 256 B
link-HASH.js gzip 1.9 kB 1.9 kB
routerDirect..HASH.js gzip 314 B 314 B
script-HASH.js gzip 375 B 375 B
withRouter-HASH.js gzip 309 B 309 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 13.3 kB 13.3 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 458 B 458 B
Overall change 458 B 458 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 531 B 531 B
link.html gzip 545 B 545 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB
Commit: 15ad51632f9f18d55119eda4ea8e064ec3ba7f60

ijjk avatar Dec 01 '21 20:12 ijjk

Failing test suites

Commit: 15ad51632f9f18d55119eda4ea8e064ec3ba7f60

test/integration/react-streaming-and-server-components/test/index.test.js

  • concurrentFeatures - prod > should generate rsc middleware manifests
Expand output

● concurrentFeatures - prod › should generate rsc middleware manifests

expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false

  127 |     context.server = await nextStart(context.appDir, context.appPort)
  128 |   })
> 129 |   afterAll(async () => {
      |                         ^
  130 |     error500Page.delete()
  131 |     await killApp(context.server)
  132 |   })

  at integration/react-streaming-and-server-components/test/index.test.js:129:35
      at Array.forEach (<anonymous>)
  at Object.<anonymous> (integration/react-streaming-and-server-components/test/index.test.js:128:15)

test/integration/react-18/test/index.test.js

  • Concurrent mode > concurrentFeatures is enabled (dev) > should hydrate suspenses on client side if suspended on server
Expand output

● Concurrent mode › concurrentFeatures is enabled (dev) › should hydrate suspenses on client side if suspended on server

TIMED OUT: /true/

undefined

  479 |     if (!this.originalContent) {
  480 |       this.originalContent = content
> 481 |     }
      |      ^
  482 |     writeFileSync(this.path, content, 'utf8')
  483 |   }
  484 |

  at Object.check (lib/next-test-utils.js:481:15)
  at integration/react-18/test/concurrent.js:51:13
  at withBrowser (integration/react-18/test/concurrent.js:18:13)
  at Object.<anonymous> (integration/react-18/test/concurrent.js:50:9)

ijjk avatar Dec 01 '21 20:12 ijjk

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 24.4s 24.5s ⚠️ +58ms
buildDurationCached 4.5s 4.3s -154ms
nodeModulesSize 347 MB 347 MB -1.55 kB
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 4.158 4.057 -0.1
/ avg req/sec 601.19 616.29 +15.1
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 2.142 2.143 0
/error-in-render avg req/sec 1166.99 1166.47 ⚠️ -0.52
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 28.4 kB 28.4 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 72.3 kB 72.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.37 kB 1.37 kB
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 326 B 326 B
dynamic-HASH.js gzip 2.38 kB 2.38 kB
head-HASH.js gzip 350 B 350 B
hooks-HASH.js gzip 635 B 635 B
image-HASH.js gzip 4.49 kB 4.49 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 1.87 kB 1.87 kB
routerDirect..HASH.js gzip 321 B 321 B
script-HASH.js gzip 383 B 383 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 13.3 kB 13.3 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 460 B 460 B
Overall change 460 B 460 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 532 B 532 B
link.html gzip 545 B 545 B
withRouter.html gzip 527 B 527 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 26.8s 26.6s -185ms
buildDurationCached 4.3s 4.3s ⚠️ +51ms
nodeModulesSize 347 MB 347 MB -1.55 kB
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 4.116 4.041 -0.07
/ avg req/sec 607.44 618.71 +11.27
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 2.098 2.109 ⚠️ +0.01
/error-in-render avg req/sec 1191.75 1185.43 ⚠️ -6.32
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.3 kB 42.3 kB
main-HASH.js gzip 28.6 kB 28.6 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 72.5 kB 72.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 305 B 305 B
css-HASH.js gzip 321 B 321 B
dynamic-HASH.js gzip 2.37 kB 2.37 kB
head-HASH.js gzip 342 B 342 B
hooks-HASH.js gzip 622 B 622 B
image-HASH.js gzip 4.53 kB 4.53 kB
index-HASH.js gzip 256 B 256 B
link-HASH.js gzip 1.9 kB 1.9 kB
routerDirect..HASH.js gzip 314 B 314 B
script-HASH.js gzip 375 B 375 B
withRouter-HASH.js gzip 309 B 309 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 13.3 kB 13.3 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 458 B 458 B
Overall change 458 B 458 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 531 B 531 B
link.html gzip 545 B 545 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB
Commit: 76520bc6e8aa4712438bab7043e2a7673f192545

ijjk avatar Dec 01 '21 23:12 ijjk

Failing test suites

Commit: 76520bc6e8aa4712438bab7043e2a7673f192545

test/integration/react-18/test/index.test.js

  • Concurrent mode > concurrentFeatures is enabled (dev) > should hydrate suspenses on client side if suspended on server
Expand output

● Concurrent mode › concurrentFeatures is enabled (dev) › should hydrate suspenses on client side if suspended on server

TIMED OUT: /true/

undefined

  479 |     if (!this.originalContent) {
  480 |       this.originalContent = content
> 481 |     }
      |      ^
  482 |     writeFileSync(this.path, content, 'utf8')
  483 |   }
  484 |

  at Object.check (lib/next-test-utils.js:481:15)
  at integration/react-18/test/concurrent.js:51:13
  at withBrowser (integration/react-18/test/concurrent.js:18:13)
  at Object.<anonymous> (integration/react-18/test/concurrent.js:50:9)

ijjk avatar Dec 02 '21 00:12 ijjk

Stats from current PR

Default Build (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 18s 17.5s -508ms
buildDurationCached 3.3s 3.1s -123ms
nodeModulesSize 348 MB 348 MB -1.65 kB
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 3.055 2.954 -0.1
/ avg req/sec 818.22 846.19 +27.97
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.319 1.338 ⚠️ +0.02
/error-in-render avg req/sec 1895.29 1868.94 ⚠️ -26.35
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 30.2 kB 30.2 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 74 kB 74 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.37 kB 1.37 kB
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 326 B 326 B
dynamic-HASH.js gzip 2.37 kB 2.37 kB
head-HASH.js gzip 350 B 350 B
hooks-HASH.js gzip 919 B 919 B
image-HASH.js gzip 4.73 kB 4.73 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.13 kB 2.13 kB
routerDirect..HASH.js gzip 321 B 321 B
script-HASH.js gzip 383 B 383 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.1 kB 14.1 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 459 B 459 B
Overall change 459 B 459 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 532 B 532 B
link.html gzip 546 B 546 B
withRouter.html gzip 526 B 526 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary shuding/next.js shu/631f Change
buildDuration 20.1s 19.1s -1s
buildDurationCached 3.3s 3.5s ⚠️ +155ms
nodeModulesSize 348 MB 348 MB -1.65 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary shuding/next.js shu/631f Change
/ failed reqs 0 0
/ total time (seconds) 3.049 2.983 -0.07
/ avg req/sec 819.81 838.07 +18.26
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.347 1.389 ⚠️ +0.04
/error-in-render avg req/sec 1855.56 1800.14 ⚠️ -55.42
Client Bundles (main, webpack, commons)
vercel/next.js canary shuding/next.js shu/631f Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.3 kB 42.3 kB
main-HASH.js gzip 30.3 kB 30.3 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 74.3 kB 74.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js shu/631f Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary shuding/next.js shu/631f Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 305 B 305 B
css-HASH.js gzip 321 B 321 B
dynamic-HASH.js gzip 2.36 kB 2.36 kB
head-HASH.js gzip 342 B 342 B
hooks-HASH.js gzip 906 B 906 B
image-HASH.js gzip 4.75 kB 4.75 kB
index-HASH.js gzip 256 B 256 B
link-HASH.js gzip 2.19 kB 2.19 kB
routerDirect..HASH.js gzip 314 B 314 B
script-HASH.js gzip 375 B 375 B
withRouter-HASH.js gzip 309 B 309 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.1 kB 14.1 kB
Client Build Manifests
vercel/next.js canary shuding/next.js shu/631f Change
_buildManifest.js gzip 459 B 459 B
Overall change 459 B 459 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js shu/631f Change
index.html gzip 532 B 532 B
link.html gzip 546 B 546 B
withRouter.html gzip 526 B 526 B
Overall change 1.6 kB 1.6 kB
Commit: 5bd11a0355bc3784805d9532d8f92e5f3eef097f

ijjk avatar Dec 16 '21 14:12 ijjk

Failing test suites

Commit: 5bd11a0355bc3784805d9532d8f92e5f3eef097f

test/integration/react-streaming-and-server-components/test/index.test.js

  • concurrentFeatures - dev > should support next/link
  • concurrentFeatures - dev > should support partial hydration with inlined server data
Expand output

● concurrentFeatures - dev › should support next/link

expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: undefined

  258 |     )
  259 |     const dynamicRouteHTML2 = await renderViaHTTP(
> 260 |       context.appPort,
      |                       ^
  261 |       '/routes/dynamic2'
  262 |     )
  263 |

  at Object.<anonymous> (integration/react-streaming-and-server-components/test/index.test.js:260:56)

● concurrentFeatures - dev › should support partial hydration with inlined server data

expect(received).toBe(expected) // Object.is equality

Expected: "next_streaming_fallback"
Received: undefined

  326 |           gotData = result.includes('next_streaming_data')
  327 |           if (!gotFallback) {
> 328 |             gotFallback = result.includes('next_streaming_fallback')
      |                                                                     ^
  329 |             if (gotFallback) {
  330 |               expect(gotData).toBe(false)
  331 |             }

  at Object.<anonymous> (integration/react-streaming-and-server-components/test/index.test.js:328:80)

ijjk avatar Dec 16 '21 14:12 ijjk