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

Commit 088b1fe

Browse files
committed
fix(template): fix handling multiple async template updates
Closes #174
1 parent feb2602 commit 088b1fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/template.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ export function replaceBundleJsTemplate(bundleSourceText: string, newTemplateCon
137137
const oldTemplate = bundleSourceText.substring(startIndex, endIndex + suffix.length);
138138
const newTemplate = getTemplateFormat(htmlFilePath, newTemplateContent);
139139

140-
while (bundleSourceText.indexOf(oldTemplate) > -1) {
141-
bundleSourceText = bundleSourceText.replace(oldTemplate, newTemplate);
140+
let lastChange: string = null;
141+
while (bundleSourceText.indexOf(oldTemplate) > -1 && bundleSourceText !== lastChange) {
142+
lastChange = bundleSourceText = bundleSourceText.replace(oldTemplate, newTemplate);
142143
}
143144

144145
return bundleSourceText;

0 commit comments

Comments
 (0)