Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional layer for server components case #36921

Merged
merged 10 commits into from May 16, 2022

Conversation

timneutkens
Copy link
Member

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

@ijjk ijjk added created-by: Next.js team PRs by the Next.js team type: next labels May 15, 2022
@ijjk
Copy link
Member

ijjk commented May 15, 2022

Failing test suites

Commit: ccd2642

yarn testheadless test/e2e/views-dir/index.test.ts

  • views dir > server components > should not serve .client.js as a path
Expand output

● views dir › server components › should not serve .client.js as a path

expect(received).toContain(expected) // indexOf

Expected substring: "hello from root/should-not-serve-client"
Received string:    "<!DOCTYPE html><html><head><style data-next-hide-fouc=\"true\">body{display:none}</style><noscript data-next-hide-fouc=\"true\"><style>body{display:block}</style></noscript><meta charSet=\"utf-8\"/><meta name=\"viewport\" content=\"width=device-width\"/><meta name=\"next-head-count\" content=\"2\"/><noscript data-n-css=\"\"></noscript><link rel=\"preload\" href=\"/_next/static/chunks/webpack.js?ts=1652626742160\" as=\"script\"/><link rel=\"preload\" href=\"/_next/static/chunks/main.js?ts=1652626742160\" as=\"script\"/><link rel=\"preload\" href=\"/_next/static/chunks/pages/_app.js?ts=1652626742160\" as=\"script\"/><link rel=\"preload\" href=\"/_next/static/chunks/pages/_error.js?ts=1652626742160\" as=\"script\"/><noscript id=\"__next_css__DO_NOT_USE__\"></noscript></head><body><div id=\"__next\"></div><script src=\"/_next/static/chunks/react-refresh.js?ts=1652626742160\"></script><script id=\"__NEXT_DATA__\" type=\"application/json\">{\"props\":{\"pageProps\":{\"statusCode\":500}},\"page\":\"/_error\",\"query\":{\"__NEXT_PAGE\":\"/should-not-serve-client/page\"},\"buildId\":\"development\",\"isFallback\":false,\"err\":{\"name\":\"TypeError\",\"message\":\"__webpack_modules__[moduleId] is not a function\",\"stack\":\"TypeError: __webpack_modules__[moduleId] is not a function\\n    at __webpack_require__ (/tmp/next-install-1652626723030/.next/server/webpack-runtime.js:33:42)\\n    at requireModule (/tmp/next-install-1652626723030/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js:81:23)\\n    at initializeModuleChunk (/tmp/next-install-1652626723030/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js:246:15)\\n    at readChunk (/tmp/next-install-1652626723030/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack.development.js:152:14)\\n    at renderLazyComponent (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5747:19)\\n    at renderElement (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5842:11)\\n    at renderNodeDestructive (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5898:11)\\n    at renderNode (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6030:12)\\n    at renderHostElement (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5456:3)\\n    at renderElement (/tmp/next-install-1652626723030/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5765:5)\"},\"gip\":true,\"scriptLoader\":[]}</script><script nomodule=\"\" src=\"/_next/static/chunks/polyfills.js?ts=1652626742160\"></script><script src=\"/_next/static/chunks/webpack.js?ts=1652626742160\"></script><script src=\"/_next/static/chunks/main.js?ts=1652626742160\"></script><script src=\"/_next/static/chunks/pages/_app.js?ts=1652626742160\"></script><script src=\"/_next/static/chunks/pages/_error.js?ts=1652626742160\"></script><script src=\"/_next/static/development/_buildManifest.js?ts=1652626742160\"></script><script src=\"/_next/static/development/_ssgManifest.js?ts=1652626742160\"></script><script src=\"/_next/static/development/_middlewareManifest.js?ts=1652626742160\"></script></body></html>"

  202 |       // Without .client.js should serve
  203 |       const html = await renderViaHTTP(next.url, '/should-not-serve-client')
> 204 |       expect(html).toContain('hello from root/should-not-serve-client')
      |                    ^
  205 |
  206 |       // Should not serve `.client`
  207 |       const res = await fetchViaHTTP(

  at Object.<anonymous> (e2e/views-dir/index.test.ts:204:20)

Read more about building and testing Next.js in contributing.md.

@ijjk
Copy link
Member

ijjk commented May 15, 2022

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
buildDuration 16.1s 15.3s -800ms
buildDurationCached 6.5s 6.5s -78ms
nodeModulesSize 475 MB 475 MB ⚠️ +399 B
Page Load Tests Overall increase ✓
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
/ failed reqs 0 0
/ total time (seconds) 3.958 3.765 -0.19
/ avg req/sec 631.64 664.01 +32.37
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.389 1.282 -0.11
/error-in-render avg req/sec 1799.68 1949.93 +150.25
Client Bundles (main, webpack)
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
925.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 28.6 kB 28.6 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 72.3 kB 72.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 193 B 193 B
amp-HASH.js gzip 308 B 308 B
css-HASH.js gzip 327 B 327 B
dynamic-HASH.js gzip 2.7 kB 2.7 kB
head-HASH.js gzip 359 B 359 B
hooks-HASH.js gzip 920 B 920 B
image-HASH.js gzip 5.71 kB 5.71 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.65 kB 2.65 kB
routerDirect..HASH.js gzip 320 B 320 B
script-HASH.js gzip 391 B 391 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 15.9 kB 15.9 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
_buildManifest.js gzip 458 B 458 B
Overall change 458 B 458 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
index.html gzip 532 B 532 B
link.html gzip 544 B 544 B
withRouter.html gzip 527 B 527 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
buildDuration 18s 18s ⚠️ +29ms
buildDurationCached 6.4s 6.5s ⚠️ +40ms
nodeModulesSize 475 MB 475 MB ⚠️ +399 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
/ failed reqs 0 0
/ total time (seconds) 3.945 4.013 ⚠️ +0.07
/ avg req/sec 633.64 622.94 ⚠️ -10.7
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.385 1.402 ⚠️ +0.02
/error-in-render avg req/sec 1804.65 1783.41 ⚠️ -21.24
Client Bundles (main, webpack)
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
925.HASH.js gzip 178 B 178 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 29.1 kB 29.1 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 73 kB 73 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 179 B 179 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 324 B 324 B
dynamic-HASH.js gzip 2.72 kB 2.72 kB
head-HASH.js gzip 357 B 357 B
hooks-HASH.js gzip 921 B 921 B
image-HASH.js gzip 5.8 kB 5.8 kB
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 2.77 kB 2.77 kB
routerDirect..HASH.js gzip 322 B 322 B
script-HASH.js gzip 392 B 392 B
withRouter-HASH.js gzip 317 B 317 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
_buildManifest.js gzip 458 B 458 B
Overall change 458 B 458 B
Rendered Page Sizes
vercel/next.js canary timneutkens/next.js fix/webpack-require-error Change
index.html gzip 528 B 528 B
link.html gzip 543 B 543 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB
Commit: fa725c8

@timneutkens timneutkens marked this pull request as ready for review May 16, 2022 07:25
@timneutkens timneutkens merged commit b11d441 into vercel:canary May 16, 2022
@timneutkens timneutkens deleted the fix/webpack-require-error branch May 16, 2022 09:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants