Skip to content

Support scopes packages in externals when found in a transitive dep #1552 #1569

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

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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