Skip to content

Conversation

@xusd320
Copy link
Contributor

@xusd320 xusd320 commented Jan 7, 2026

This PR refactors the Resolution Plugin traits to add new Always or Never enum variants to resolve condition. This allow plugins (like ExternalsPlugin when no externals are configured) to skip the expensive matches() task calls entirely. Testing on a medium project showed a reduction of ~1.4k resolve_call tasks. I think this can be shared to upstream for future improvement of resolve plugin

See the metrics for improvements.
image

@nextjs-bot nextjs-bot added the Turbopack Related to Turbopack with Next.js. label Jan 7, 2026
@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Jan 7, 2026

Allow CI Workflow Run

  • approve CI run for commit: 9c24b9b

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@mischnic
Copy link
Contributor

mischnic commented Jan 7, 2026

We could also have a BeforeResolvePluginCondition::None enum variant

@xusd320 xusd320 force-pushed the feat/upstream-resolve-plugin-optimization branch 3 times, most recently from bcf2793 to 045b897 Compare January 7, 2026 11:17
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 7, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing utooland:feat/upstream-resolve-plugin-optimization (1cd421b) with canary (b09df00)

Summary

✅ 17 untouched benchmarks
⏩ 3 skipped benchmarks1

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@xusd320 xusd320 force-pushed the feat/upstream-resolve-plugin-optimization branch 3 times, most recently from cdc6e07 to d20c660 Compare January 9, 2026 07:49
@xusd320 xusd320 changed the title feat(turbopack): optimize resolve plugin conditions with Option feat(turbopack): add resolve plugin condition variant Jan 9, 2026
@xusd320 xusd320 force-pushed the feat/upstream-resolve-plugin-optimization branch from d20c660 to 19d6864 Compare January 9, 2026 07:51
@xusd320 xusd320 changed the title feat(turbopack): add resolve plugin condition variant feat(turbopack): add resolve plugin condition variant of Always and Never Jan 9, 2026
@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Jan 9, 2026

Failing test suites

Commit: 1cd421b | About building and testing Next.js

pnpm test-start-turbo test/e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts (turbopack) (job)

  • segment cache (revalidation) > delay re-prefetch after revalidation to allow CDN propagation (DD)
Expand output

● segment cache (revalidation) › delay re-prefetch after revalidation to allow CDN propagation

page.waitForSelector: Timeout 5000ms exceeded.
Call log:
  - waiting for locator('#greeting') to be visible

  519 |
  520 |     return this.startChain(async () => {
> 521 |       const el = await page.waitForSelector(selector, {
      |                             ^
  522 |         timeout,
  523 |         state,
  524 |       })

  at waitForSelector (lib/browsers/playwright.ts:521:29)
  at Playwright._chain (lib/browsers/playwright.ts:651:23)
  at Playwright._chain [as startChain] (lib/browsers/playwright.ts:632:17)
  at Playwright.startChain [as waitForElementByCss] (lib/browsers/playwright.ts:520:17)
  at Playwright.waitForElementByCss [as elementByCss] (lib/browsers/playwright.ts:405:17)
  at Playwright.elementByCss [as elementById] (lib/browsers/playwright.ts:425:17)
  at elementById (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:363:38)
  at act (lib/router-act.ts:296:27)
  at Object.<anonymous> (e2e/app-dir/segment-cache/revalidation/segment-cache-revalidation.test.ts:358:5)

@xusd320 xusd320 force-pushed the feat/upstream-resolve-plugin-optimization branch from b39ccaa to 143135a Compare January 9, 2026 09:49
@xusd320 xusd320 force-pushed the feat/upstream-resolve-plugin-optimization branch from 143135a to 9c24b9b Compare January 9, 2026 09:50
@mischnic mischnic added the CI approved Approve running CI for fork label Jan 9, 2026
@mischnic mischnic merged commit d1f8a3b into vercel:canary Jan 9, 2026
295 of 300 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI approved Approve running CI for fork Turbopack Related to Turbopack with Next.js. type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants