Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
How do you import a local jQuery into webview for VS Code extensions?

how does one import jquery into webview? I attempted to modify:

https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/

to utilize the jquery library by adding it to the same location as main.js and then adding something like this:

const jqueryPathOnDisk = vscode.Uri.joinPath(this._extensionUri, 'media', 'jquery-3.6.0.min.js');
const jqueryUri = (jqueryPathOnDisk).with({ 'scheme': 'vscode-resource' });

followed by

<script nonce="${nonce}" src="${jqueryUri}"></script>

Around here in the code:

https://github.com/microsoft/vscode-extension-samples/blob/116b0aa1ade25bfd3c6f3df0847200089b82b72f/webview-sample/src/extension.ts#L171

But unfortunately this doesn’t seem to work.

I've also attempted to delete the following line:

                <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}';">

from this file: https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts

And then importing a cdn but that also does not work. No matter what window.jQuery returns undefined.

Any insight would. be appreciated.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda