bug: Sharp 0.35 fails in dev after external symlink targets dist directory

オープン
#4,511 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@7430souvik がすでに取り組んでいます。

2026年8月6日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
node.js, typescript
領域
build-system, cli

調査の方向性

Start with packages/cli-v3/src/build/externals.ts, especially the external-linking logic at lines 30–78. Use the linked reproduction repo and run pnpm dev with a valid project ref to observe the generated Sharp symlink and indexing failure. Done when Sharp's package root is linked, task indexing succeeds, and the local worker becomes ready.

索引モデルが issue の本文から書いたものです。

説明

Provide environment information

System:
OS: macOS 26.5.2
CPU: (12) arm64 Apple M2 Pro
Memory: 102.86 MB / 16.00 GB
Shell: 5.9 - /bin/zsh

Binaries:
Node: 24.15.0
npm: 11.12.1
pnpm: 11.10.0
bun: 1.3.14

Describe the bug

When trigger dev processes a task importing [email protected], automatic external detection creates the generated worker's node_modules/sharp symlink pointing to Sharp's dist directory instead of its package root.

This bypasses Sharp's root package.json, which defines its dist/index.mjs and dist/index.cjs entry points. Node consequently looks for sharp/index.js, which does not exist, and task indexing fails with ERR_MODULE_NOT_FOUND.

Importing the same Sharp installation directly outside Trigger.dev works correctly.

Expected behavior: the task is indexed and the local worker becomes ready.

Reproduction repo

https://github.com/benpixel/trigger-sharp-035-repro

To reproduce
  1. Clone and install the reproduction:

    git clone https://github.com/benpixel/trigger-sharp-035-repro.git
    cd trigger-sharp-035-repro
    pnpm install
    
  2. Authenticate the Trigger.dev CLI and provide a valid project ref:

    TRIGGER_PROJECT_REF=proj_your_project_ref pnpm dev
    
  3. Task indexing fails with:

    Error: Could not import trigger/sharp-task.ts
    
    Error: Cannot find package '.../node_modules/sharp/index.js'
    imported from '.../trigger/sharp-task.mjs'
    
    Did you mean to import "sharp/dist/index.cjs"?
    
Additional information

Confirmed with:

The generated symlink was inspected while trigger dev was running:

.trigger/tmp/build-*/node_modules/sharp
  -> node_modules/.pnpm/[email protected]_*/node_modules/sharp/dist

Importing Sharp directly succeeds:

node --input-type=module -e 'const { default: sharp } = await import("sharp"); console.log(sharp.versions.sharp)'
0.35.3

Controls:

  • Pinning Sharp to 0.34.5 allows the local worker to become ready.
  • Setting build.autoDetectExternal to false also avoids the failure, but disables automatic externalization globally.
  • The minimal reproduction contains no Next.js dependency.

The relevant external-linking implementation appears to be here:

https://github.com/triggerdotdev/trigger.dev/blob/v4.5.9/packages/cli-v3/src/build/externals.ts#L30-L78

主要言語
TypeScript
スター
16.5k
フォーク
1.5k
平均マージ
1日 15時間
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

triggerdotdev/trigger.dev のほかの issue

triggerdotdev/trigger.dev の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。