Skip to content

This repo is a standard install of Next.js showcasing a bug for symlinks not working when linked inside app directory

Notifications You must be signed in to change notification settings

snivels/symlinks-not-working

Repository files navigation

I am creating a directory outside of the project, let's call it vendors and creating a symlink from app/vendor to one of these vendors in this external directory. However, when navigating to a page.tsx inside one of these directories it just results in 404 being shown in the browser.

I've tried to trace the code and it seems to be resolving the symlinks correctly in the next\dist\lib\recursive-readdir.js file inside the recursiveReadDir function. When testing whether a link is a directory or a pathname it correctly (seemingly) ends up in the directories array.

image

I've created a minimal reproduction of the issue and linked the repo to this discussion.

Steps to reproduce:

  1. Clone the repo attached
  2. npm i
  3. Navigate to src\apps in the command line
  4. Create a symlink in Windows by running mklink /D vendor ..\..\vendors\test-vendor-1 or in Unix with ln -s ../../vendors/test-vendor-1 vendor
  5. npm run dev
  6. Navigate to http://localhost:3000/vendor/posts

Observe the following:

image

If you remove the symlink and paste the vendor files directly into the app/vendor folder you observe:

image

Link to repo with reproduction.

About

This repo is a standard install of Next.js showcasing a bug for symlinks not working when linked inside app directory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published