Skip to content

Commit

Permalink
Support scopes packages in externals when found in a transitive dep #…
Browse files Browse the repository at this point in the history
…1552 (#1569)

* Support scopes packages in externals when found in a transitive dep

* fixed typescript errro

* Add changeset
  • Loading branch information
ericallam authored Dec 16, 2024
1 parent f3e4597 commit 88a0754
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-plants-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

Fix externals from monorepo packages with scoped package names #1552
21 changes: 21 additions & 0 deletions packages/cli-v3/src/build/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ async function linkExternal(external: CollectedExternal, resolveDir: string, log
external,
});

// For scoped packages, we need to ensure the scope directory exists
if (external.name.startsWith("@")) {
// Get the scope part (e.g., '@huggingface')
const scopeDir = external.name.split("/")[0];

if (scopeDir) {
const scopePath = join(destinationPath, scopeDir);

logger.debug("[externals] Ensure scope directory exists", {
scopeDir,
scopePath,
});

await mkdir(scopePath, { recursive: true });
} else {
logger.debug("[externals] Unable to get the scope directory", {
external,
});
}
}

const symbolicLinkPath = join(destinationPath, external.name);

// Make sure the symbolic link does not exist
Expand Down

0 comments on commit 88a0754

Please sign in to comment.