Skip to content

Commit 88a0754

Browse files
authored
Support scopes packages in externals when found in a transitive dep #1552 (#1569)
* Support scopes packages in externals when found in a transitive dep * fixed typescript errro * Add changeset
1 parent f3e4597 commit 88a0754

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.changeset/kind-plants-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Fix externals from monorepo packages with scoped package names #1552

packages/cli-v3/src/build/externals.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@ async function linkExternal(external: CollectedExternal, resolveDir: string, log
4545
external,
4646
});
4747

48+
// For scoped packages, we need to ensure the scope directory exists
49+
if (external.name.startsWith("@")) {
50+
// Get the scope part (e.g., '@huggingface')
51+
const scopeDir = external.name.split("/")[0];
52+
53+
if (scopeDir) {
54+
const scopePath = join(destinationPath, scopeDir);
55+
56+
logger.debug("[externals] Ensure scope directory exists", {
57+
scopeDir,
58+
scopePath,
59+
});
60+
61+
await mkdir(scopePath, { recursive: true });
62+
} else {
63+
logger.debug("[externals] Unable to get the scope directory", {
64+
external,
65+
});
66+
}
67+
}
68+
4869
const symbolicLinkPath = join(destinationPath, external.name);
4970

5071
// Make sure the symbolic link does not exist

0 commit comments

Comments
 (0)