From 68a10cc0af095f8435fc1508c0c6dd3b92605f08 Mon Sep 17 00:00:00 2001 From: Preston Hales Date: Fri, 6 Dec 2024 13:38:42 -0700 Subject: [PATCH] Fix --watch to work for script imports when done in the current directory --- src/ops/ScriptOps.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ops/ScriptOps.ts b/src/ops/ScriptOps.ts index 1aac05af7..f0f3527e2 100644 --- a/src/ops/ScriptOps.ts +++ b/src/ops/ScriptOps.ts @@ -676,13 +676,16 @@ function getExtractedPathsAndNames( ): { path: string; id: string }[] { const extractedFileNames = []; const scriptExport = getScriptExport(file); - const directory = file.substring(0, file.lastIndexOf('/')) || '.'; + const directory = + file.lastIndexOf('/') === -1 + ? '' + : file.substring(0, file.lastIndexOf('/')) + '/'; for (const script of Object.values(scriptExport.script)) { if (!isScriptExtracted(script.script)) { continue; } extractedFileNames.push({ - path: `${directory}/${(script.script as string).replace('file://', '')}`, + path: `${directory}${(script.script as string).replace('file://', '')}`, id: script._id, }); }