#19

next-best-practices: proxy.ts matcher example exports proxyConfig, which Next does not read

Openjloranceopened 1mo ago

What is wrong

next-best-practices/file-conventions.md documents the v16 proxy file convention as:

versionfilefunctionconfig export
v16+proxy.tsproxy()proxyConfig

Next reads the matcher from export const config. proxyConfig is not a recognised export, so a matcher written from this row never applies and the proxy runs on every request.

How to check it

Against the documentation that ships with the package, for the exact installed version:

$ cat node_modules/next/package.json | jq -r .version
16.3.4

$ rg -l proxyConfig node_modules/next/dist/docs/
# no files

$ rg -n -A3 'export const config' node_modules/next/dist/docs/01-app/03-api-reference/03-file-conventions/proxy.md
36:export const config = {
37:  matcher: '/about/:path*',
38:}

Two more in the same skill

  • bundling.md — the "Good: use dynamic import with ssr: false" example has no 'use client', so Page is a Server Component, where Next rejects next/dynamic(..., { ssr: false }) at build time.
  • data-patterns.md — "Server Component fetch | Internal reads | Any | Full Next.js caching" describes pre-15 behaviour; fetch is not cached by default in 15+.

Related

The same files ship inside the Vercel plugin's nextjs skill, filed as vercel/vercel-plugin#199.

Activity

0

No activity yet.