Symlinked app pages fail to resolve in DEV but not PRODUCTION
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
Binaries:
Node: 18.12.1
npm: 9.7.1
Yarn: 1.22.18
pnpm: 8.6.6
Relevant Packages:
next: 13.4.13-canary.1
eslint-config-next: 13.4.12
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Routing (next/router, next/navigation, next/link), SWC transpilation
Link to the code that reproduces this issue or a replay of the bug
https://github.com/cseitz/next-13.4.13-bug-symlinked-app-dir/
To Reproduce
Running next dev and visiting localhost:3000/test1 will 404 NOT FOUND.
However, running next build and next start and visiting localhost:3000/test1 will work just fine.
(Additional details in the README of my repo)
Describe the Bug
I am using a symlinked directory within my app folder. This symlink route 404's in development, but works perfectly in production.
- I have a directory,
src/features/test1/app, that is symlinked intosrc/app/(features)/(test1) - I symlinked this folder via
ln -sr "./src/features/test1/app" "./src/app/(features)/(test1)" - Running
next devand visitinglocalhost:3000/test1will404 NOT FOUND
Expected Behavior
When running via next dev:
- Visiting
localhost:3000/test1should rendersrc/features/test1/app/test1/page.tsx, which is located within the symlinked folder - That
next devmirrors the behavior ofnext build && next start(which is proven to support this symlink feature as it works in production)
Which browser are you using? (if relevant)
Chrome 114.0.5735.199
How are you deploying your application? (if relevant)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked reproduction repository and its README, then run next dev against /test1 and compare it with next build followed by next start. Trace how the symlinked src/app/(features)/(test1) directory resolves to src/features/test1/app/test1/page.tsx; done means development renders /test1 like production without breaking ordinary App Router routes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, react
- Domain
- devtools, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100