From 8870a170f0701ce05f1a297ac00043500d98cdb2 Mon Sep 17 00:00:00 2001 From: intodevelopment <6976899+intodevelopment@users.noreply.github.com> Date: Fri, 1 Mar 2019 14:43:22 +0100 Subject: [PATCH] fix(livereload): find all bundles to update HTML template of components is not updated by ionic serve after saving the file. When a module is shared among multiple modules, e.g., a components module, the component template is present in multiple bundle files, so the template should be replaced in all bundle files. --- src/template.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/template.ts b/src/template.ts index 101c6bd5..27c52b32 100644 --- a/src/template.ts +++ b/src/template.ts @@ -22,13 +22,12 @@ export function templateUpdate(changedFiles: ChangedFile[], context: BuildContex if (!updateCorrespondingJsFile(context, file.content, changedTemplateFile.filePath)) { throw new Error(`Failed to inline template ${changedTemplateFile.filePath}`); } - // find the corresponding bundle + // find the corresponding bundles for (const bundleFile of bundleFiles) { const newContent = replaceExistingJsTemplate(bundleFile.content, file.content, changedTemplateFile.filePath); if (newContent && newContent !== bundleFile.content) { context.fileCache.set(bundleFile.path, { path: bundleFile.path, content: newContent}); writeFileSync(bundleFile.path, newContent); - break; } } }