Using vscode webview example as a starting point.
When I generateHTML and add 2 <script/> tags only the first one actually runs
private _getHtmlForWebview({webview, catGifPath, catName}: {
webview: vscode.Webview, catGifPath: string, catName: string,
}) {
const div1Modifier = (vscode.Uri.joinPath(this._extensionUri, 'media', 'div-1-modifier.js'))
.with({'scheme': 'vscode-resource'});
const div2Modifier = (vscode.Uri.joinPath(this._extensionUri, 'media', 'div-2-modifier.js'))
.with({'scheme': 'vscode-resource'});
return `<!DOCTYPE html>
<html lang="en">
<body>
<div id="my-div-1">
Initial div-1 content
</div>
<div id="my-div-2">
Initial div-2 content
</div>
</body>
<script src="${div1Modifier}" />
<script src="${div2Modifier}"/>
</html>`;
}
Output:
modified from div-1-modifier.js
Initial div-2 content
If I swap the order of the <script/> tags:
<script src="${div2Modifier}"/>
<script src="${div1Modifier}" />
Then the div2Modifier runs, getting output:
Initial div-1 content
modified from div-2-modifier.js
How to approach fixing this, to get both of the <script/> tags to run?