Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(livereload): find all bundles to update
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
intodevelopment authored and liamdebeasi committed Mar 1, 2019
1 parent aeef5ee commit 8870a17
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 8870a17

Please sign in to comment.