Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
VSCode Extension: webview only first included <script/> runs

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

Full code example

How to approach fixing this, to get both of the <script/> tags to run?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!