-
Notifications
You must be signed in to change notification settings - Fork 237
docs: March docs audit and alignment #1466
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
Changes from all commits
b0a1255
b32d9ff
589c6c4
903a68c
0a7e783
8f22bc7
611cbe1
2ac92bd
461d70d
ed920df
ebcbbcc
8df415e
b90fcb6
6eee8b6
4c71f3c
9084920
49fd5e8
1e5c88b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,57 @@ const workflowConfig = {} | |
| export default withWorkflow(nextConfig, workflowConfig); // [!code highlight] | ||
| ``` | ||
|
|
||
| ### Monorepos and Workspace Imports | ||
|
|
||
| By default, Next.js detects the correct workspace root automatically. If your Next.js app lives in a subdirectory such as `apps/web` and workspace resolution is not working correctly, you can set `outputFileTracingRoot` as a workaround: | ||
|
|
||
| ```typescript title="apps/web/next.config.ts" lineNumbers | ||
| import { resolve } from "node:path"; | ||
| import type { NextConfig } from "next"; | ||
| import { withWorkflow } from "workflow/next"; | ||
|
|
||
| const nextConfig: NextConfig = { | ||
| outputFileTracingRoot: resolve(process.cwd(), "../.."), | ||
| }; | ||
|
|
||
| export default withWorkflow(nextConfig); | ||
| ``` | ||
|
|
||
| <Callout type="info"> | ||
| Use the smallest directory that contains every workspace package imported by your workflows. If your app already lives at the repository root, you do not need to set `outputFileTracingRoot`. | ||
| </Callout> | ||
|
|
||
| ## Options | ||
|
|
||
| `withWorkflow` accepts an optional second argument to configure the Next.js integration. | ||
|
|
||
| ```typescript title="next.config.ts" lineNumbers | ||
| import type { NextConfig } from "next"; | ||
| import { withWorkflow } from "workflow/next"; | ||
|
|
||
| const nextConfig: NextConfig = {}; | ||
|
|
||
| export default withWorkflow(nextConfig, { | ||
| workflows: { | ||
| lazyDiscovery: true, | ||
| local: { | ||
| port: 4000, | ||
| }, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| | Option | Type | Default | Description | | ||
| | --- | --- | --- | --- | | ||
| | `workflows.lazyDiscovery` | `boolean` | `false` | When `true`, defers workflow discovery until files are requested instead of scanning eagerly at startup. Useful for large projects where startup time matters. | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed with team — lazyDiscovery is not shipping as default for GA. Docs are accurate as opt-in. |
||
| | `workflows.local.port` | `number` | — | Overrides the `PORT` environment variable for local development. Has no effect when deployed to Vercel. | | ||
|
|
||
| <Callout type="info"> | ||
| The `workflows.local` options only affect local development. When deployed to Vercel, the runtime ignores `local` settings and uses the Vercel world automatically. | ||
| </Callout> | ||
|
|
||
| ## Exporting a Function | ||
|
|
||
| If you are exporting a function in your `next.config` you will need to ensure you call the function returned from `withWorkflow`. | ||
|
|
||
| ```typescript title="next.config.ts" lineNumbers | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijjk can you validate is this is right? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by default Next.js should detect the right value we should only mention this as a workaround if things are detecting correctly