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

Turbopack: migrate global module ids to single-graph #73752

Draft
wants to merge 16 commits into
base: canary
Choose a base branch
from

Conversation

mischnic
Copy link
Contributor

@mischnic mischnic commented Dec 10, 2024

  • Run another pass of single-graph generation so that we can add modules that need graph information (e.g. server actions)

Closes PACK-3540
Closes PACK-3292

@ijjk ijjk added created-by: Turbopack team PRs by the Turbopack team. Turbopack Related to Turbopack with Next.js. labels Dec 10, 2024
@mischnic mischnic changed the title Migrate global module ids to single-graph Turbopack: migrate global module ids to single-graph Dec 10, 2024
@ijjk
Copy link
Member

ijjk commented Dec 10, 2024

Failing test suites

Commit: f2a6218

pnpm test-start-turbo test/e2e/app-dir/dynamic/dynamic.test.ts (turbopack)

  • app dir - next/dynamic > should handle ssr: false in pages when appDir is enabled
  • app dir - next/dynamic > should handle next/dynamic in SSR correctly
  • app dir - next/dynamic > should handle next/dynamic in hydration correctly
  • app dir - next/dynamic > should generate correct client manifest for dynamic chunks
  • app dir - next/dynamic > should render loading by default if loading is specified and loader is slow
  • app dir - next/dynamic > should not render loading by default
  • app dir - next/dynamic > no SSR > should not render client component imported through ssr: false in client components
  • app dir - next/dynamic > no SSR > should support dynamic import with accessing named exports from client component
  • app dir - next/dynamic > no SSR > should support dynamic import with TLA in client components
Expand output

● app dir - next/dynamic › should handle ssr: false in pages when appDir is enabled

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › should handle next/dynamic in SSR correctly

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › should handle next/dynamic in hydration correctly

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › should generate correct client manifest for dynamic chunks

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › should render loading by default if loading is specified and loader is slow

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › should not render loading by default

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › no SSR › should not render client component imported through ssr: false in client components in edge runtime

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › no SSR › should not render client component imported through ssr: false in client components

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › no SSR › should support dynamic import with accessing named exports from client component

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

● app dir - next/dynamic › no SSR › should support dynamic import with TLA in client components

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

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

pnpm test-dev-turbo test/e2e/app-dir/non-root-project-monorepo/non-root-project-monorepo.test.ts (turbopack)

  • non-root-project-monorepo > source-maps > should work on RSC
Expand output

● non-root-project-monorepo › source-maps › should work on RSC

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `non-root-project-monorepo source-maps should work on RSC 2`

- Snapshot  - 1
+ Received  + 1

  <unknown>
- [project]/apps/web/app/separate-file.ts [app-rsc] (ecmascript) (rsc://React/Server/file://<full-path>/apps/web/.next/server/chunks/ssr/apps_web_8d1c0a._.js (7:7)
+ [project]/apps/web/app/separate-file.ts [app-rsc] (ecmascript) (rsc://React/Server/file://<full-path>/apps/web/.next/server/chunks/ssr/apps_web_b7421c._.js (7:7)
  innerFunction
  app/source-maps-rsc/page.tsx (10:3)
  Page
  app/source-maps-rsc/page.tsx (4:5)

  79 |           // TODO stacktrace-parser breaks in some cases with the rsc:// protocol
  80 |           expect(normalizeStackTrace(await getRedboxCallStack(browser)))
> 81 |             .toMatchInlineSnapshot(`
     |              ^
  82 |            "<unknown>
  83 |            [project]/apps/web/app/separate-file.ts [app-rsc] (ecmascript) (rsc://React/Server/file://<full-path>/apps/web/.next/server/chunks/ssr/apps_web_8d1c0a._.js (7:7)
  84 |            innerFunction

  at Object.toMatchInlineSnapshot (e2e/app-dir/non-root-project-monorepo/non-root-project-monorepo.test.ts:81:14)

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

pnpm test-start-turbo test/e2e/app-dir/random-in-sass/random-in-sass.test.ts (turbopack)

  • random-in-sass > should work using browser
Expand output

● random-in-sass › should work using browser

next build failed with code/signal 1

   98 |           if (code || signal)
   99 |             reject(
> 100 |               new Error(`next build failed with code/signal ${code || signal}`)
      |               ^
  101 |             )
  102 |           else resolve()
  103 |         })

  at ChildProcess.<anonymous> (lib/next-modes/next-start.ts:100:15)

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

pnpm test-start-turbo test/e2e/app-dir/resource-url-encoding/resource-url-encoding.test.ts (turbopack)

  • scripts > encodes characters in app router
Expand output

● scripts › encodes characters in app router

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

Expected substring: not "#"
Received string:        "http://localhost:36123/_next/static/chunks/app_client#component_tsx_052f87._.js"

  18 |       for (const script of scripts) {
  19 |         const src = await script.evaluate((script) => script.src)
> 20 |         expect(src).not.toContain('#')
     |                         ^
  21 |         expect(src).not.toContain('[')
  22 |       }
  23 |     }

  at toContain (e2e/app-dir/resource-url-encoding/resource-url-encoding.test.ts:20:25)

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

pnpm test test/integration/clean-distdir/test/index.test.js

  • Cleaning distDir > production mode > should clean up .next before build start
  • Cleaning distDir > production mode > disabled write > should not clean up .next before build start
Expand output

● Cleaning distDir › production mode › should clean up .next before build start

thrown: "Exceeded timeout of 60000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

  25 |
  26 | const runTests = () => {
> 27 |   it('should clean up .next before build start', async () => {
     |   ^
  28 |     await checkFileWrite(false)
  29 |   })
  30 | }

  at it (integration/clean-distdir/test/index.test.js:27:3)
  at runTests (integration/clean-distdir/test/index.test.js:40:7)
  at integration/clean-distdir/test/index.test.js:33:56
  at Object.describe (integration/clean-distdir/test/index.test.js:32:1)

● Cleaning distDir › production mode › disabled write › should not clean up .next before build start

command failed with code 1 signal null
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/clean-distdir/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/clean-distdir/next.config.js
   ▲ Next.js 15.1.1-canary.13

   Linting and checking validity of types ...

 ⚠ The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/app/api-reference/config/eslint#migrating-existing-config
   Creating an optimized production build ...
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/clean-distdir/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/clean-distdir/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/clean-distdir/next.config.js
 ✓ Compiled successfully
   Collecting page data ...

> Build optimization failed: found page without a React Component as default export in 
pages/

See https://nextjs.org/docs/messages/page-without-valid-component for more info.

  308 |       ) {
  309 |         return reject(
> 310 |           new Error(
      |           ^
  311 |             `command failed with code ${code} signal ${signal}\n${mergedStdio}`
  312 |           )
  313 |         )

  at ChildProcess.<anonymous> (lib/next-test-utils.ts:310:11)

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

@ijjk
Copy link
Member

ijjk commented Dec 10, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
buildDuration 18.8s 16s N/A
buildDurationCached 15s 12.8s N/A
nodeModulesSize 416 MB 416 MB N/A
nextStartRea..uration (ms) 478ms 480ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
1187-HASH.js gzip 52.4 kB 52.4 kB N/A
8276.HASH.js gzip 169 B 168 B N/A
8377-HASH.js gzip 5.36 kB 5.36 kB N/A
bccd1874-HASH.js gzip 53 kB 53 kB N/A
framework-HASH.js gzip 57.5 kB 57.5 kB N/A
main-app-HASH.js gzip 232 B 235 B N/A
main-HASH.js gzip 34.1 kB 34.1 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB N/A
Overall change 0 B 0 B
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
_app-HASH.js gzip 193 B 193 B
_error-HASH.js gzip 193 B 193 B
amp-HASH.js gzip 512 B 510 B N/A
css-HASH.js gzip 343 B 342 B N/A
dynamic-HASH.js gzip 1.84 kB 1.84 kB
edge-ssr-HASH.js gzip 265 B 265 B
head-HASH.js gzip 363 B 362 B N/A
hooks-HASH.js gzip 393 B 392 B N/A
image-HASH.js gzip 4.49 kB 4.49 kB N/A
index-HASH.js gzip 268 B 268 B
link-HASH.js gzip 2.35 kB 2.34 kB N/A
routerDirect..HASH.js gzip 328 B 328 B
script-HASH.js gzip 397 B 397 B
withRouter-HASH.js gzip 323 B 326 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 3.59 kB 3.59 kB
Client Build Manifests
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
_buildManifest.js gzip 749 B 746 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
index.html gzip 524 B 524 B
link.html gzip 539 B 537 B N/A
withRouter.html gzip 520 B 521 B N/A
Overall change 524 B 524 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
edge-ssr.js gzip 129 kB 129 kB N/A
page.js gzip 205 kB 205 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
middleware-b..fest.js gzip 670 B 667 B N/A
middleware-r..fest.js gzip 155 B 156 B N/A
middleware.js gzip 31.3 kB 31.3 kB N/A
edge-runtime..pack.js gzip 844 B 844 B
Overall change 844 B 844 B
Next Runtimes
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
274-experime...dev.js gzip 322 B 322 B
274.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 356 kB 356 kB
app-page-exp..prod.js gzip 129 kB 129 kB
app-page-tur..prod.js gzip 142 kB 142 kB
app-page-tur..prod.js gzip 137 kB 137 kB
app-page.run...dev.js gzip 347 kB 347 kB
app-page.run..prod.js gzip 125 kB 125 kB
app-route-ex...dev.js gzip 37.5 kB 37.5 kB
app-route-ex..prod.js gzip 25.5 kB 25.5 kB
app-route-tu..prod.js gzip 25.5 kB 25.5 kB
app-route-tu..prod.js gzip 25.3 kB 25.3 kB
app-route.ru...dev.js gzip 39.1 kB 39.1 kB
app-route.ru..prod.js gzip 25.3 kB 25.3 kB
pages-api-tu..prod.js gzip 9.69 kB 9.69 kB
pages-api.ru...dev.js gzip 11.6 kB 11.6 kB
pages-api.ru..prod.js gzip 9.68 kB 9.68 kB
pages-turbo...prod.js gzip 21.7 kB 21.7 kB
pages.runtim...dev.js gzip 27.5 kB 27.5 kB
pages.runtim..prod.js gzip 21.7 kB 21.7 kB
server.runti..prod.js gzip 916 kB 916 kB
Overall change 2.43 MB 2.43 MB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js mischinc/module-ids-single-graph Change
0.pack gzip 2.08 MB 2.08 MB N/A
index.pack gzip 73.6 kB 74.9 kB ⚠️ +1.3 kB
Overall change 73.6 kB 74.9 kB ⚠️ +1.3 kB
Diff details
Diff for main-HASH.js

Diff too large to display

Commit: f2a6218

@mischnic mischnic force-pushed the mischnic/single-traversal-client-references branch from d3f5611 to a19a0dc Compare December 10, 2024 20:46
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 800a6dc to eadbd66 Compare December 10, 2024 20:46
@mischnic mischnic force-pushed the mischnic/single-traversal-client-references branch from a19a0dc to 5051ae5 Compare December 10, 2024 21:02
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from eadbd66 to 674bd22 Compare December 10, 2024 21:03
@mischnic mischnic force-pushed the mischnic/single-traversal-client-references branch from 5051ae5 to 1051e12 Compare December 10, 2024 21:04
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 674bd22 to a6b75a7 Compare December 10, 2024 21:05
@mischnic mischnic force-pushed the mischnic/single-traversal-client-references branch 2 times, most recently from 3960bda to 3f5ca85 Compare December 11, 2024 11:30
@mischnic mischnic changed the base branch from mischnic/single-traversal-client-references to graphite-base/73752 December 11, 2024 12:13
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from a6b75a7 to b99a698 Compare December 11, 2024 13:51
@mischnic mischnic changed the base branch from graphite-base/73752 to canary December 11, 2024 13:51
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from b99a698 to c068537 Compare December 12, 2024 11:35
@mischnic mischnic changed the base branch from canary to mischnic/single-graph-edge-type December 12, 2024 11:35
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from c068537 to 7b7e7cb Compare December 12, 2024 13:03
@mischnic mischnic force-pushed the mischnic/single-graph-edge-type branch from d053c5d to 2cd4af9 Compare December 13, 2024 13:52
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 7b7e7cb to 8c99ebc Compare December 13, 2024 13:52
@mischnic mischnic changed the base branch from mischnic/single-graph-edge-type to graphite-base/73752 December 13, 2024 19:37
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 8c99ebc to ef41bf7 Compare December 13, 2024 19:37
@mischnic mischnic force-pushed the graphite-base/73752 branch from 2cd4af9 to 4ba5843 Compare December 13, 2024 19:37
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch 4 times, most recently from b502b15 to 2bc6c7c Compare December 18, 2024 14:15
@ijjk ijjk added the tests label Dec 18, 2024
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 2bc6c7c to 0e8a763 Compare December 18, 2024 15:38
@mischnic mischnic changed the base branch from canary to mischnic/next-dynamic-transition December 18, 2024 15:38
@mischnic mischnic force-pushed the mischnic/next-dynamic-transition branch from 533d4b1 to 39b6afb Compare December 19, 2024 09:04
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from 0e8a763 to ef12b9d Compare December 19, 2024 09:04
@mischnic mischnic changed the base branch from mischnic/next-dynamic-transition to graphite-base/73752 December 19, 2024 11:34
@mischnic mischnic force-pushed the graphite-base/73752 branch from 39b6afb to 53bb90c Compare December 19, 2024 13:19
@mischnic mischnic force-pushed the mischinc/module-ids-single-graph branch from ef12b9d to f2a6218 Compare December 19, 2024 13:19
@mischnic mischnic changed the base branch from graphite-base/73752 to canary December 19, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
created-by: Turbopack team PRs by the Turbopack team. tests Turbopack Related to Turbopack with Next.js. type: next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants