Dynamic Routes in Symlinks is not working
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Bug report
Describe the bug
Dynamic Routes in symlinks is not working
To Reproduce
I don't think github repos support symlink commits so this is how you can reproduce this:
In project folder:
mkdir pages/nolink
echo "export default function Post() {return <div>Works</div>}" > "pages/nolink/[id].js"
echo "export default function index() {return <div>Works</div>}" > "pages/nolink/index.js"
ln -s nolink pages/symlinktest
- http://localhost:3000/symlinktest/123 shows "404 This page could not be found."
- http://localhost:3000/symlinktest/ shows "works"
- http://localhost:3000/nolink/123 shows "works"
- http://localhost:3000/nolink/ shows "works"
Expected behavior
- http://localhost:3000/symlinktest/123 should show "works"
System information
- OS: Linux
- Version of Next.js: ^9.5.2
- Version of Node.js: v12.18.2
Additional context
I also tried this in next.config.js:
module.exports = {
webpack: (config, { buildId, dev }) => {
config.resolve.symlinks = false
return config
},
}
index.js is for debug the error. Removing index.js did not help. This points to Dynamic Routes not supporting symlinks.
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 by reproducing the routes using pages/nolink/[id].js, pages/nolink/index.js, the pages/symlinktest link, and the shown next.config.js webpack setting. Trace how dynamic routes are discovered for symlinked pages, then verify that /symlinktest/123 resolves while the existing non-dynamic routes continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100