Skip to content

Update connect-next docs for Turbopack compatibility#1665

Open
emcfarlane wants to merge 1 commit intoconnectrpc:mainfrom
emcfarlane:ed/turbopack
Open

Update connect-next docs for Turbopack compatibility#1665
emcfarlane wants to merge 1 commit intoconnectrpc:mainfrom
emcfarlane:ed/turbopack

Conversation

@emcfarlane
Copy link
Copy Markdown

This updates the docs to better support Next.js v16. Update the recommended usage pattern for nextJsApiRouter() to export config as a static literal. Deprecate the config property on the ApiRoute return type.

Next.js 16 uses Turbopack as the default bundler. Turbopack reads the AST of route files at compile time to extract config values like api.bodyParser. It only recognizes inline export declarations (export const config = ...) and does not trace references from export specifiers (export { config }) back to their declarations. See the custom config examples.

The previously recommended pattern re-exported config from the nextJsApiRouter() return value, which produces an AST node with no inline initializer. Turbopack treats this as a fatal error (upgraded from warning in vercel/next.js#83297).

Contributes towards #1645

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants