diff --git a/internal/backends/nodejs/grab.go b/internal/backends/nodejs/grab.go index 973b972d..f4e8544e 100644 --- a/internal/backends/nodejs/grab.go +++ b/internal/backends/nodejs/grab.go @@ -164,9 +164,27 @@ func guessBareImports() map[api.PkgName]bool { continue } + // Skip empty imports + if mod == "" { + continue + } + + // Skip absolute imports + if mod[0] == '/' { + continue + } + + // Skip relative imports if mod[0] == '.' { continue } + + // Skip script loaders + if strings.Contains(mod, "!") { + continue + } + + // Handle scoped modules if mod[0] == '@' { parts := strings.Split(mod, "/") if len(parts) < 2 {