From 9a1378816777447e7005d3750b004802e439db0f Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Sat, 24 May 2025 10:32:55 -0500 Subject: [PATCH] Devmode: improve sourcemap when node_module is outside project --- internal/bundler/shim.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/bundler/shim.go b/internal/bundler/shim.go index 206a0472..78b1fd68 100644 --- a/internal/bundler/shim.go +++ b/internal/bundler/shim.go @@ -89,9 +89,9 @@ Error.prepareStackTrace = function (err, stack) { if (pos && pos.source) { const startIndex = filename.indexOf('.agentuity/'); const offset = filename.includes('../node_modules/') ? 11 : 0; - const basedir = filename.substring(0, startIndex + offset); const sourceOffset = pos.source.indexOf('src/'); const source = pos.source.substring(sourceOffset); + const basedir = filename.substring(0, startIndex + offset) + (source.startsWith('../') ? '.agentuity' : ''); const newfile = __agentuity_join(basedir, source); const newline = parts[1] + '(' + newfile + ':' + pos.line + ':' + pos.column + ')'; lines.push(newline);