This repository is prepared to reproduce and analyze Turbopack's behavior when using symbolic links to modules outside the project directory.
The repository contains two folders:
next.js
- A Next.js project that demonstrates the issue. This project references theinternal-module
.internal-module
- A sample module that is linked to the Next.js project. This module is used to demonstrate the behavior of symbolic links.
-
What happens:
When installing theinternal-module
using a local path (e.g.,npm install ../internal-module
), a symbolic link to this module insidenode-modules
is created. If the module resides outside the project directory, Turbopack fails to detect it and throws an error. -
Specific behavior:
If theinternal-module
is located inside the project directory and also uses a symbolic link, the module is resolved correctly without errors.
- Clone this repository:
git clone https://github.com/dimak-dev/turbopack-local-module-symlink-bug.git cd turbopack-local-module-symlink-bug
- Navigate to the
next.js
directory:cd next.js
- Start the Next.js development server using Turbopack:
npm run dev:turbo
- Observe the error indicating that Turbopack cannot resolve the
internal-module
(Build Error: Module not found: Can't resolve 'internal-module').
Note: If you run
npm run dev:webpack
, where Turbopack support is disabled, no issues occur.
- Turbopack should correctly resolve modules linked via symbolic links, even if those modules reside outside the project directory.
- Turbopack throws an error when attempting to resolve the
internal-module
if it is located outside the project directory.
The purpose of this repository is to reproduce and investigate this behavior in Turbopack, allowing for further debugging and facilitating communication with the Turbopack development team.