[next] make lazyDiscovery the default in withWorkflow#1805
Conversation
Flips the default for `workflows.lazyDiscovery` from `false` to `true`
so new projects get deferred workflow discovery automatically on Next.js
versions that support deferred entries (>= 16.2.0-canary.48). Older
versions continue to fall back to eager discovery.
Users can still opt back into eager discovery explicitly by passing
`workflows: { lazyDiscovery: false }`.
Also:
- Remove the now-redundant `lazyDiscovery: true` from the Next.js
workbench apps.
- Reword the fallback warning for clarity when lazy is the default.
- Update the local-build e2e assertion to match the new warning text.
- Update the withWorkflow docs with the new default.
🦋 Changeset detectedLatest commit: ebc2d07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)No data available SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
❌ Some benchmark jobs failed:
Check the workflow run for details.
Check the workflow run for details. |
There was a problem hiding this comment.
Pull request overview
Makes deferred workflow discovery (“lazyDiscovery”) the default behavior for withWorkflow on the next branch, updates examples/docs accordingly, and adjusts workbench/e2e expectations to match the new default and warning text.
Changes:
- Flip
withWorkflow’s defaultworkflows.lazyDiscoverybehavior to enabled unless explicitly set tofalse. - Remove redundant
lazyDiscovery: trueoverrides from Next.js workbench apps and update tests to validate the new default. - Reword the Next.js version fallback warning and update docs and e2e assertions to match.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| workbench/nextjs-webpack/next.config.ts | Removes explicit lazyDiscovery: true now that it’s the default. |
| workbench/nextjs-turbopack/next.config.ts | Removes explicit lazyDiscovery: true and keeps config minimal. |
| packages/next/src/index.ts | Implements default-on lazyDiscovery behavior (opt-out with false). |
| packages/next/src/index.test.ts | Adds unit tests asserting default/explicit true/explicit false env-var behavior. |
| packages/next/src/builder.ts | Updates the fallback warning message when Next.js is too old for deferred mode. |
| packages/core/e2e/local-build.test.ts | Updates e2e warning assertion to match the new warning text. |
| docs/content/docs/api-reference/workflow-next/with-workflow.mdx | Updates docs to reflect default true and how to force eager discovery. |
| .changeset/lazy-discovery-default.md | Adds changeset documenting the default change and opt-out. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(process.env.WORKFLOW_NEXT_LAZY_DISCOVERY).toBe('1'); | ||
| }); | ||
|
|
||
| it('disables lazyDiscovery when explicitly set to false', async () => { |
There was a problem hiding this comment.
These it(...) blocks are marked async but don't await anything. Consider removing async (or adding awaited behavior if intended) to avoid misleading tests / potential lints about unused promises.
| it('disables lazyDiscovery when explicitly set to false', async () => { | |
| it('disables lazyDiscovery when explicitly set to false', () => { |
|
No backport to This commit flips the default value of To override, re-run the Backport to stable workflow manually via |
Summary
workflows.lazyDiscoveryinwithWorkflowfromfalsetotrueso new projects automatically get deferred workflow discovery on Next.js >= 16.2.0-canary.48workflows: { lazyDiscovery: false }on supported Next.js versionslazyDiscovery: truefrom thenextjs-turbopackandnextjs-webpackworkbench appswithWorkflowdocs to reflect the new defaultCompanion PR
The companion change for
stable(which keeps the current default but removes the workbench override so stable e2e tests still exercise eager mode) is in #1804.