diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..eb3b4d48d Binary files /dev/null and b/.DS_Store differ diff --git a/crates/.DS_Store b/crates/.DS_Store new file mode 100644 index 000000000..75368568e Binary files /dev/null and b/crates/.DS_Store differ diff --git a/napi/.DS_Store b/napi/.DS_Store new file mode 100644 index 000000000..1d93e2274 Binary files /dev/null and b/napi/.DS_Store differ diff --git a/napi/angular-compiler/vite-plugin/index.ts b/napi/angular-compiler/vite-plugin/index.ts index 7fa326167..067345cc0 100644 --- a/napi/angular-compiler/vite-plugin/index.ts +++ b/napi/angular-compiler/vite-plugin/index.ts @@ -370,6 +370,13 @@ export function angular(options: PluginOptions = {}): Plugin[] { event: 'angular:component-update', data: eventData, }) + + // Invalidate Vite's module transform cache so that a full page reload + // picks up the new template/style content instead of serving stale output. + const mod = server.moduleGraph.getModuleById(componentFile) + if (mod) { + server.moduleGraph.invalidateModule(mod) + } } } } @@ -654,6 +661,14 @@ export function angular(options: PluginOptions = {}): Plugin[] { debugHmr('componentIds keys: %O', Array.from(componentIds.keys())) if (isComponent && hasComponentId) { + // If there's a pending HMR update for this component, the .ts module + // was invalidated by our fs.watch handler (template/style change), not + // by an actual .ts file edit. Skip the full reload — HMR handles it. + if (pendingHmrUpdates.has(ctx.file)) { + debugHmr('skipping full reload — pending HMR update from template/style change') + return [] + } + debugHmr('triggering full reload for component file change') // Component FILE changes require a full reload because: // - Class definition changes can't be hot-swapped safely