[perf]: add configurable dirs option to withWorkflow#843
Conversation
🦋 Changeset detectedLatest commit: 1da647b The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (161 failed)mongodb (40 failed):
redis (40 failed):
starter (41 failed):
turso (40 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
Allow users to specify which directories to scan for workflow directives, helping reduce memory usage and build times in large Next.js applications. - Add `dirs` option that overrides the default directories - Document all configuration options in API reference - Add troubleshooting guide for OOM errors during build
Add missing import statements and nextConfig declaration to the troubleshooting code example to fix docs typecheck.
Move the OOM troubleshooting section from the API reference to the existing troubleshooting section in docs/getting-started/next.mdx for better discoverability.
|
@karthikscale3 I think this makes sense, but why don't you include "src/workflows" and "workflows" by default? That seems to be even more important than all the other directories, as e.g. the docs for Next.js suggest this directory. Which feels right, just like I would put "components", "lib", "actions" etc. next to the "app" folder, not inside it. |
Summary
Adds a
dirsconfiguration option towithWorkflow()that allows users to specify which directories to scan for workflow directives. This addresses OOM errors in large Next.js applications where scanning the entirepages/appdirectories consumes excessive memory.Changes
dirsoption towithWorkflow()config (overrides defaults when provided)['pages', 'app', 'src/pages', 'src/app']withWorkflowconfiguration options in API referenceUsage
import { withWorkflow } from "workflow/next";
export default withWorkflow(nextConfig, {
// Only scan specific directories instead of entire app
dirs: ['workflows', 'app/api'],
});