From 3f5e52ed62fd0dbc63f906f73c46a43f7e386a7e Mon Sep 17 00:00:00 2001 From: Dylan Piercey Date: Thu, 5 Oct 2023 13:42:16 -0700 Subject: [PATCH] fix: improve vitest support --- .changeset/seven-icons-nail.md | 5 +++++ src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/seven-icons-nail.md diff --git a/.changeset/seven-icons-nail.md b/.changeset/seven-icons-nail.md new file mode 100644 index 0000000..213964e --- /dev/null +++ b/.changeset/seven-icons-nail.md @@ -0,0 +1,5 @@ +--- +"@marko/vite": patch +--- + +Fix issue where queries added from vitest were not being stripped diff --git a/src/index.ts b/src/index.ts index 28294e9..57b66ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -851,7 +851,7 @@ function stripVersionAndTimeStamp(id: string) { const queryStart = id.indexOf("?"); if (queryStart === -1) return id; const url = id.slice(0, queryStart); - const query = id.slice(queryStart + 1).replace(/(?:^|[&])[vt]=[^&]/g, ""); + const query = id.slice(queryStart + 1).replace(/(?:^|[&])[vt]=[^&]+/g, ""); if (query) return `${url}?${query}`; return url; }