Skip to content
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/chilly-sites-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": patch
---

fix(auto-instrumentation): Skip over file transforms in bundler plugins when id is undefined
5 changes: 5 additions & 0 deletions js/src/auto-instrumentations/bundler/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export const unplugin = createUnplugin<BundlerPluginOptions>((options = {}) => {
name: "code-transformer",
enforce: "pre",
transform(code: string, id: string) {
if (!id) {
// Some modules apparently don't have an id?
return null;
}

// Convert file:// URLs to regular paths at entry point
// Node.js ESM loader hooks provide file:// URLs, but downstream code expects paths
const filePath = id.startsWith("file:") ? fileURLToPath(id) : id;
Expand Down
Loading