diff --git a/linker.go b/linker.go index 0c91eaf..aa658b3 100644 --- a/linker.go +++ b/linker.go @@ -14,7 +14,7 @@ type Linker struct { func new_linker(paths string) Linker { quoted := `([='"])(` + paths + ")" - hue_base := `window.HUE_BASE_URL\s*[+]\s*'/hue'\s*[+]` + hue_base := `window.HUE_BASE_URL\s*[+]\s*'/hue'` linker := Linker{ quoted_reg: regexp.MustCompile(quoted), @@ -28,7 +28,7 @@ func (l *Linker) replace(file []byte, service_prefix string) []byte { prefix := "$1" + strings.TrimSuffix(service_prefix, "/") + "$2" replaced := l.quoted_reg.ReplaceAll(file, []byte(prefix)) - replaced = l.hue_base_url.ReplaceAll(replaced, []byte("window.HUE_BASE_URL +")) + replaced = l.hue_base_url.ReplaceAll(replaced, []byte("window.HUE_BASE_URL")) return replaced } diff --git a/linker_test.go b/linker_test.go index 0d42e29..e6887b9 100644 --- a/linker_test.go +++ b/linker_test.go @@ -32,7 +32,11 @@ func TestLinker(t *testing.T) { }, { `link = window.HUE_BASE_URL+'/hue'+link;`, - `link = window.HUE_BASE_URL +link;`, + `link = window.HUE_BASE_URL+link;`, + }, + { + `page__WEBPACK_IMPORTED_MODULE_3___default().base(window.HUE_BASE_URL + '/hue');`, + `page__WEBPACK_IMPORTED_MODULE_3___default().base(window.HUE_BASE_URL);`, }, }