Skip to content

Commit d9f8221

Browse files
committed
fix: ensure analyzed child templates invalidate their parent compilation in tags api
1 parent 9bbed0c commit d9f8221

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.changeset/ripe-baths-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@marko/vite": patch
3+
---
4+
5+
Fix issue with live reload of tags api files with changing child templates.

src/index.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -968,14 +968,24 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
968968
this.addWatchFile(file);
969969
}
970970

971-
transformOptionalFiles.set(id, [
972-
`${optionalFilePrefix}style.*`,
973-
`${optionalFilePrefix}component.*`,
974-
`${optionalFilePrefix}component-browser.*`,
975-
`${optionalFilePrefix}marko-tag.json`,
976-
]);
977-
978-
transformWatchFiles.set(id, meta.watchFiles);
971+
transformOptionalFiles.set(
972+
id,
973+
meta.api === "tags"
974+
? [`${optionalFilePrefix}style.*`]
975+
: [
976+
`${optionalFilePrefix}style.*`,
977+
`${optionalFilePrefix}marko-tag.json`,
978+
`${optionalFilePrefix}component.*`,
979+
`${optionalFilePrefix}component-browser.*`,
980+
],
981+
);
982+
983+
transformWatchFiles.set(
984+
id,
985+
meta.analyzedTags
986+
? meta.analyzedTags.concat(meta.watchFiles)
987+
: meta.watchFiles,
988+
);
979989
}
980990
return {
981991
code,

0 commit comments

Comments
 (0)