previewjs
previewjs copied to clipboard
[Windows 10 not WSL] Error loading webview
Describe the bug
After I managed to install Preview.js in my VSCode and tried to open a preview of my component, it is showing an error like this.

OS: Windows 10 VSCode Version: 1.70.0 Node Version: 16.14.2
Reproduction
- Install Preview.js from the extensions tab.
- Restart VSCode IDE
- Create a new ReactJS from CRA or ViteJS
- Click the
Open App.jsx in Preview.js
Preview.js version
v1.11.0
Framework
React 18.0.0
System Info
System:
OS: Windows 10 10.0.19043
CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
Memory: 12.99 GB / 31.93 GB
Binaries:
Node: 16.14.2 - ~\.nvm\versions\node\v16.14.2\bin\node.EXE
Yarn: 1.22.18 - ~\.nvm\versions\node\v16.14.2\bin\yarn.CMD
npm: 8.15.1 - ~\.nvm\versions\node\v16.14.2\bin\npm.CMD
IDEs:
Android Studio: AI-212.5712.43.2112.8609683
VSCode: 1.70.0 - C:\Users\Jazzi\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Visual Studio: 16.11.32228.343 (Visual Studio Community 2019)
Browsers:
Edge: Spartan (44.19041.1266.0)
Internet Explorer: 11.0.19041.1566
Used Package Manager
npm
Extension logs (useful for crashes)
No response
Preview logs (useful for rendering errors)
No response
Repo link (if available)
No response
Anything else?
No response
The temporary fix that I did is to run vscode with an argument of --no-sandbox as suggested from this issue https://github.com/microsoft/vscode/issues/122951
Thanks for finding the underlying issue @dashawk.
Unfortunately I can't seem to find a way to solve this from the extension, as it's a wider VS Code issue.
One option would be to make it skip the webview entirely, i.e. open in a new tab in your browser instead. Would that work for you?
This is solved now that the status bar lets you choose "Open in external browser".