You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm using toolkit with react+vite. I want to show an image in the webview, like this:
// the user.png is located on webview-ui/src/user.png
import userImg from "../user.png";
...
<img src={userImg} />
However, this does not work, and shows error message:
vscode-webview://1iav15db5tskk3lc073po39q8usqupebm0gshfqarponor92ka9s/assets/user.png:1 GET vscode-webview://1iav15db5tskk3lc073po39q8usqupebm0gshfqarponor92ka9s/assets/user.png net::ERR_ACCESS_DENIED
Accroding to GPT, another way it to get the image uri via message. However, this is unnecessary complex, and need to maintain a state to store the uri.
Hi,
I'm using toolkit with react+vite. I want to show an image in the webview, like this:
However, this does not work, and shows error message:
There's also a similar issue in stackoverflow.
I've tried to add csp rules, and also not work:
I find a blog says that it's needed to serve the image by a virtual server, and it seems that the css is actually loaded by a virtual https url:
The uri could be build in extension using
getUri
:However, this is not possible in webview-ui.
Can you suggest us how to use custom images (especially in react framework)?
The text was updated successfully, but these errors were encountered: