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

Ouverte
#4,511 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@7430souvik y travaille déjà.

Depuis le 6/8/2026.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
68/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Calme
Stack technique
node.js, typescript
Domaine
build-system, cli

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
TypeScript
Étoiles
16.5k
Forks
1.5k
Merge moyen
1 j 15 h
PR mergées (30 j)
17

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de triggerdotdev/trigger.dev

Toutes les issues de triggerdotdev/trigger.dev

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.