Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbopack does not resolve "local" linked/file dependencies. #65125

Open
YeetmanLord opened this issue Apr 27, 2024 · 0 comments
Open

Turbopack does not resolve "local" linked/file dependencies. #65125

YeetmanLord opened this issue Apr 27, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Runtime Related to Node.js or Edge Runtime with Next.js. Turbopack Related to Turbopack with Next.js.

Comments

@YeetmanLord
Copy link

YeetmanLord commented Apr 27, 2024

Link to the code that reproduces this issue

https://github.com/YeetmanLord/NextJsError/tree/main

To Reproduce

  1. Install dependencies for the mock ui-library. Then run npm run build to build the code.
  2. Install dependencies for the server
  3. Run the server using npm run dev which executes next dev --turbo.
  4. Go to the web server's root. (In my case localhost:3000).

Error should be outputted at this point.

Current vs. Expected behavior

Turbopack is not resolving locally included dependencies. By "locally included dependency", I mean libraries that are added to a project either through a direct file inclusion (through package.json and "file:<path_to_dependency>") or through npm link <package-name>. Both methods include a link/shortcut to the relevant package.

I would assume that it is the directory link that is causing the issue.

This is the page output without tacking on --turbo to next dev (so packaged using Webpack):
image

Turbopack should resolve linked packages just as it would resolve packages installed into node_modules.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home
  Available memory (MB): 32666
  Available CPU cores: 16
Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime, Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

As far as I can tell, this error has always been around. I tested with next versions 13.0.0, 13.5.6, 14.0.0, 14.1.0, 14.2.0, 14.2.3, and 14.3.0-canary.29.

With 14.2.3, the stacktrace outputted into console is such:

Module not found: Can't resolve 'ui-library'

> 1 | import {TestComponent} from "ui-library";
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2 |
  3 | export default function Home() {
  4 |     return (

    at processIssues (node_modules\next\dist\server\dev\turbopack-utils.js:229:15)
    at handleRouteType (node_modules\next\dist\server\dev\turbopack-utils.js:386:17)
    at async Object.ensurePage (node_modules\next\dist\server\dev\hot-reloader-turbopack.js:644:17)
    at async DevBundlerService.ensurePage (node_modules\next\dist\server\lib\dev-bundler-service.js:18:20)
    at async DevServer.ensurePage (node_modules\next\dist\server\dev\next-dev-server.js:551:9)
    at async Object.ensure (node_modules\next\dist\server\dev\next-dev-server.js:169:17)
    at async DevRouteMatcherManager.matchAll (node_modules\next\dist\server\future\route-matcher-managers\dev-route-matcher-manager.js:96:13)
    at async DevRouteMatcherManager.match (node_modules\next\dist\server\future\route-matcher-managers\default-route-matcher-manager.js:155:26)
    at async NextNodeServer.handleCatchallRenderRequest (node_modules\next\dist\server\next-server.js:228:31)
    at async DevServer.handleRequestImpl (node_modules\next\dist\server\base-server.js:816:17)
    at async node_modules\next\dist\server\dev\next-dev-server.js:339:20
    at async Span.traceAsyncFn (node_modules\next\dist\trace\trace.js:154:20)
    at async DevServer.handleRequest (node_modules\next\dist\server\dev\next-dev-server.js:336:24)
    at async invokeRender (node_modules\next\dist\server\lib\router-server.js:174:21)
    at async handleRequest (node_modules\next\dist\server\lib\router-server.js:353:24)
    at async requestHandlerImpl (node_modules\next\dist\server\lib\router-server.js:377:13)
    at async Server.requestListener (node_modules\next\dist\server\lib\start-server.js:141:13)

  Compiled /_error in 460ms
 GET / 500 in 1508ms

PACK-3026

@YeetmanLord YeetmanLord added the bug Issue was opened via the bug report template. label Apr 27, 2024
@github-actions github-actions bot added Runtime Related to Node.js or Edge Runtime with Next.js. Turbopack Related to Turbopack with Next.js. labels Apr 27, 2024
@timneutkens timneutkens added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Runtime Related to Node.js or Edge Runtime with Next.js. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

2 participants