Skip to content

Commit

Permalink
fix: arc integration caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Nov 30, 2023
1 parent d326a8e commit 0e25919
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-shirts-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/vite": patch
---

Fix caching issue with virtual Marko files created by arc
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const virtualFiles = new Map<
string,
VirtualFile | DeferredPromise<VirtualFile>
>();
const extReg = /\.[^.]+$/;
const queryReg = /\?marko-[^?]+$/;
const browserEntryQuery = "?marko-browser-entry";
const serverEntryQuery = "?marko-server-entry";
Expand Down Expand Up @@ -551,8 +552,12 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
async transform(source, rawId, ssr) {
let id = stripVersionAndTimeStamp(rawId);
const info = isBuild ? this.getModuleInfo(id) : undefined;
if (info?.meta.arcSourceId) {
id = info.meta.arcSourceId;
const arcSourceId = info?.meta.arcSourceId;
if (arcSourceId) {
const arcFlagSet = info.meta.arcFlagSet;
id = arcFlagSet
? arcSourceId.replace(extReg, `[${arcFlagSet.join("+")}]$&`)
: arcSourceId;
}

const isSSR = typeof ssr === "object" ? ssr.ssr : ssr;
Expand Down

0 comments on commit 0e25919

Please sign in to comment.