fix(docs): small next config changes#7508
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughNext.js configuration in apps/docs was updated to use a fixed assetPrefix of '/docs' with allowedDevOrigins added for development proxy asset loading. TypeScript configuration was reformatted with multi-line array declarations and a new type declaration path entry added. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🍈 Lychee Link Check Report3660 links: ❌ Errors
Full Statistics Table
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/docs/next.config.mjs`:
- Around line 8-10: The allowedDevOrigins entry is using a URL with scheme;
change allowedDevOrigins to ['prisma.io'] (remove 'http://') and update the
comment next to allowedDevOrigins to clarify whether prisma.io is expected to be
mapped to localhost via hosts file for proxying or if another hostname should be
used; also make assetPrefix conditional so it is only '/docs' in non-development
builds (e.g. use assetPrefix: process.env.NODE_ENV === 'development' ? '' :
'/docs' or honor an env var like ASSET_PREFIX) so local dev does not break asset
routing unless your proxy setup explicitly serves assets under /docs.
In `@apps/docs/tsconfig.json`:
- Around line 47-48: Remove the incorrect duplicate path
".next/dev/dev/types/**/*.ts" from the tsconfig "include" array in
apps/docs/tsconfig.json; keep the correct Next.js type globs (e.g.,
".next/types/**/*.ts" and ".next/dev/types/**/*.ts") so the include entries
match the other apps and no dead config remains.
| assetPrefix: '/docs', | ||
| // Allow website (localhost:3001) to load assets when proxying docs | ||
| allowedDevOrigins: ['http://prisma.io'], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n apps/docs/next.config.mjsRepository: prisma/web
Length of output: 2397
🌐 Web query:
Next.js allowedDevOrigins configuration option format expected values
💡 Result:
allowedDevOrigins is set in next.config.js/ts as an array of strings:
// next.config.js
module.exports = {
allowedDevOrigins: ['local-origin.dev', '*.local-origin.dev'],
}Expected values: each entry is a hostname (domain) or IP you want to allow in development, and you can use a leading wildcard for subdomains (e.g. *.example.com). The official docs show hostnames (not full URLs) as the intended format. [1]
In practice, if you’re trying to allow something like http://127.0.0.1:3000, you typically need to provide just 127.0.0.1 (i.e., omit the http:// and port). [2]
Sources: [1] Next.js docs, allowedDevOrigins option. [2] Next.js community thread discussing format pitfalls.
🏁 Script executed:
# Check for any environment-based logic in the file
head -30 apps/docs/next.config.mjsRepository: prisma/web
Length of output: 873
The allowedDevOrigins format is incorrect and needs fixing.
The value 'http://prisma.io' includes the protocol scheme, but Next.js expects just the hostname. Change it to 'prisma.io' (without the http://). The comment mentioning localhost:3001 also seems misaligned with the actual value — clarify the intent: are you mapping prisma.io to localhost in your hosts file for the proxy setup, or should this be a different hostname?
Additionally, the assetPrefix: '/docs' is now unconditional — assets will be fetched from /docs/_next/... in all environments, including local dev. Ensure your dev setup (whether proxied or direct) properly handles this asset routing, otherwise you'll have broken assets when running locally.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/docs/next.config.mjs` around lines 8 - 10, The allowedDevOrigins entry
is using a URL with scheme; change allowedDevOrigins to ['prisma.io'] (remove
'http://') and update the comment next to allowedDevOrigins to clarify whether
prisma.io is expected to be mapped to localhost via hosts file for proxying or
if another hostname should be used; also make assetPrefix conditional so it is
only '/docs' in non-development builds (e.g. use assetPrefix:
process.env.NODE_ENV === 'development' ? '' : '/docs' or honor an env var like
ASSET_PREFIX) so local dev does not break asset routing unless your proxy setup
explicitly serves assets under /docs.
| ".next/dev/types/**/*.ts", | ||
| ".next/dev/dev/types/**/*.ts" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's read the tsconfig.json file to understand the context
cat -n apps/docs/tsconfig.json | head -60Repository: prisma/web
Length of output: 1468
🏁 Script executed:
# Search for any references to .next/dev/dev in the codebase
rg '\.next/dev/dev' --type json --type ts --type jsRepository: prisma/web
Length of output: 111
🏁 Script executed:
# Also check for any .next/dev paths to understand the pattern
rg '\.next/dev' apps/docs/tsconfig.jsonRepository: prisma/web
Length of output: 118
🏁 Script executed:
# Check if there are other tsconfig.json files in the monorepo with similar patterns
find . -name "tsconfig.json" -type f | head -20Repository: prisma/web
Length of output: 211
🏁 Script executed:
# Search for any .next patterns in tsconfig files across the repo
rg '\.next/' -g 'tsconfig.json' -A 2 -B 2Repository: prisma/web
Length of output: 922
🏁 Script executed:
# Check git history to see when this line was added and if there's context
git log --oneline -n 30 -- apps/docs/tsconfig.json 2>/dev/null || echo "Git history not available"Repository: prisma/web
Length of output: 99
Remove the duplicate .next/dev/dev/types/**/*.ts path from the include array.
Line 48 contains a typo with a doubled dev segment. This pattern doesn't exist in the other Next.js app configs in the monorepo (apps/blog and apps/eclipse both use the standard .next/types/**/*.ts and .next/dev/types/**/*.ts). The extra line is dead config that won't match any actual Next.js-generated types, so it's safe to remove.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/docs/tsconfig.json` around lines 47 - 48, Remove the incorrect duplicate
path ".next/dev/dev/types/**/*.ts" from the tsconfig "include" array in
apps/docs/tsconfig.json; keep the correct Next.js type globs (e.g.,
".next/types/**/*.ts" and ".next/dev/types/**/*.ts") so the include entries
match the other apps and no dead config remains.
Summary by CodeRabbit