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

hot-reloader-turbopack refactors #61929

Merged
merged 9 commits into from
Feb 12, 2024
Merged

Conversation

timneutkens
Copy link
Member

@timneutkens timneutkens commented Feb 12, 2024

What?

Follow-up to #61917. Splitting out more code from the development handling so that it can be used for builds too in a later PR.

Closes NEXT-2429

Copy link
Member Author

timneutkens commented Feb 12, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @timneutkens and the rest of your teammates on Graphite Graphite

@ijjk
Copy link
Member

ijjk commented Feb 12, 2024

Stats from current PR

Default Build
General Overall increase ⚠️
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
buildDuration 12.9s 12.8s N/A
buildDurationCached 7.1s 6.1s N/A
nodeModulesSize 196 MB 196 MB ⚠️ +10.2 kB
nextStartRea..uration (ms) 435ms 436ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
3f784ff6-HASH.js gzip 53.5 kB 53.5 kB N/A
423.HASH.js gzip 185 B 181 B N/A
68-HASH.js gzip 29.6 kB 29.6 kB N/A
framework-HASH.js gzip 45.2 kB 45.2 kB
main-app-HASH.js gzip 238 B 239 B N/A
main-HASH.js gzip 31.9 kB 31.9 kB N/A
webpack-HASH.js gzip 1.7 kB 1.7 kB
Overall change 46.9 kB 46.9 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
_app-HASH.js gzip 194 B 195 B N/A
_error-HASH.js gzip 182 B 181 B N/A
amp-HASH.js gzip 502 B 501 B N/A
css-HASH.js gzip 320 B 322 B N/A
dynamic-HASH.js gzip 2.5 kB 2.5 kB N/A
edge-ssr-HASH.js gzip 255 B 256 B N/A
head-HASH.js gzip 350 B 349 B N/A
hooks-HASH.js gzip 368 B 369 B N/A
image-HASH.js gzip 4.19 kB 4.18 kB N/A
index-HASH.js gzip 257 B 256 B N/A
link-HASH.js gzip 2.67 kB 2.67 kB N/A
routerDirect..HASH.js gzip 310 B 311 B N/A
script-HASH.js gzip 384 B 383 B N/A
withRouter-HASH.js gzip 306 B 308 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 106 B 106 B
Client Build Manifests
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
_buildManifest.js gzip 483 B 485 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
index.html gzip 528 B 527 B N/A
link.html gzip 541 B 539 B N/A
withRouter.html gzip 523 B 522 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
edge-ssr.js gzip 94.4 kB 94.4 kB N/A
page.js gzip 150 kB 150 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
middleware-b..fest.js gzip 620 B 626 B N/A
middleware-r..fest.js gzip 151 B 149 B N/A
middleware.js gzip 47.4 kB 47.4 kB
edge-runtime..pack.js gzip 1.94 kB 1.94 kB
Overall change 49.3 kB 49.3 kB
Next Runtimes
vercel/next.js canary vercel/next.js 02-12-Initial_Turbopack_build Change
app-page-exp...dev.js gzip 166 kB 166 kB
app-page-exp..prod.js gzip 95.4 kB 95.4 kB
app-page-tur..prod.js gzip 97.2 kB 97.2 kB
app-page-tur..prod.js gzip 91.6 kB 91.6 kB
app-page.run...dev.js gzip 136 kB 136 kB
app-page.run..prod.js gzip 90.2 kB 90.2 kB
app-route-ex...dev.js gzip 22 kB 22 kB
app-route-ex..prod.js gzip 14.9 kB 14.9 kB
app-route-tu..prod.js gzip 14.9 kB 14.9 kB
app-route-tu..prod.js gzip 14.7 kB 14.7 kB
app-route.ru...dev.js gzip 21.7 kB 21.7 kB
app-route.ru..prod.js gzip 14.7 kB 14.7 kB
pages-api-tu..prod.js gzip 9.43 kB 9.43 kB
pages-api.ru...dev.js gzip 9.7 kB 9.7 kB
pages-api.ru..prod.js gzip 9.43 kB 9.43 kB
pages-turbo...prod.js gzip 22 kB 22 kB
pages.runtim...dev.js gzip 22.7 kB 22.7 kB
pages.runtim..prod.js gzip 22 kB 22 kB
server.runti..prod.js gzip 49.9 kB 49.9 kB
Overall change 924 kB 924 kB
Commit: 3d1d9f1

let versionInfo: VersionInfo = await getVersionInfo(
true || isTestMode || opts.telemetry.isEnabled
const versionInfo: VersionInfo = await getVersionInfo(
isTestMode || opts.telemetry.isEnabled
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This incorrectly was always true

@@ -1167,13 +1357,7 @@ export async function createHotReloaderTurbopack(
clearHmrServerError() {
// Not implemented yet.
},
async start() {
const enabled = isTestMode || opts.telemetry.isEnabled
const nextVersionInfo = await getVersionInfo(enabled)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already called earlier before returning the hotReloader interface, we don't have to run it twice.

rootPath: config.experimental.outputFileTracingRoot || dir,
nextConfig: config.nextConfig,
jsConfig: await getTurbopackJsConfig(dir, config),
watch: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
watch: true,
watch: false,

})

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const iter = project.entrypointsSubscribe()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should expose a non-subscribing method here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was just to get to the point where it can be called 👍

@timneutkens timneutkens enabled auto-merge (squash) February 12, 2024 11:14
@ijjk
Copy link
Member

ijjk commented Feb 12, 2024

Failing test suites

Commit: 3d1d9f1

pnpm test-dev test/e2e/app-dir/actions-navigation/index.test.ts

  • app-dir action handling > should handle actions correctly after navigation / redirection events
Expand output

● app-dir action handling › should handle actions correctly after navigation / redirection events

page.waitForSelector: Timeout 60000ms exceeded.
=========================== logs ===========================
waiting for locator('#form')
============================================================

  422 |     return this.chain(() => {
  423 |       return page
> 424 |         .waitForSelector(selector, { timeout, state: 'attached' })
      |          ^
  425 |         .then(async (el) => {
  426 |           // it seems selenium waits longer and tests rely on this behavior
  427 |           // so we wait for the load event fire before returning

  at waitForSelector (lib/browsers/playwright.ts:424:10)

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

pnpm test-start test/e2e/prerender.test.ts (PPR)

  • Prerender > should on-demand revalidate for fallback: blocking with onlyGenerated if generated
Expand output

● Prerender › should on-demand revalidate for fallback: blocking with onlyGenerated if generated

expect(received).toMatch(expected)

Expected pattern: /(HIT|STALE)/
Received string:  "MISS"

  2294 |
  2295 |         expect(initialTime).toBe($2('#time').text())
> 2296 |         expect(res2.headers.get('x-nextjs-cache')).toMatch(/(HIT|STALE)/)
       |                                                    ^
  2297 |
  2298 |         const res3 = await fetchViaHTTP(
  2299 |           next.url,

  at Object.toMatch (e2e/prerender.test.ts:2296:52)

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

@timneutkens timneutkens merged commit 94c0152 into canary Feb 12, 2024
70 checks passed
@timneutkens timneutkens deleted the 02-12-Initial_Turbopack_build branch February 12, 2024 12:17
timneutkens added a commit that referenced this pull request Feb 12, 2024
## What?

Follow-up to #61929. More refactors to move the logic out of
`createHotReloaderTurbopack` so that these functions can be used for
builds later too.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-2440
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants