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:
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.