From 734a6ce62e17bf8e86c87e2137bcc6a7b3a4cc3f Mon Sep 17 00:00:00 2001 From: pk Date: Thu, 4 Jan 2024 21:55:24 +0100 Subject: [PATCH] Fix linker to work correctly with sub paths. --- linker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linker.go b/linker.go index e40c4a1..9b5c3c5 100644 --- a/linker.go +++ b/linker.go @@ -60,7 +60,8 @@ func link(from, to string) chan struct{} { for k, v := range packages { if strings.HasPrefix(event.Path, v) { src := filepath.Dir(event.Path) - dest := filepath.Join(to, "node_modules", k) + subPath, _ := filepath.Rel(v, src) + dest := filepath.Join(to, "node_modules", k, subPath) fmt.Printf("Copying %s to %s\n", src, dest) err := copy.Copy(src, dest, copy.Options{ Skip: func(stat fs.FileInfo, src, dest string) (bool, error) {