previewjs icon indicating copy to clipboard operation
previewjs copied to clipboard

[Windows 10 not WSL] Error loading webview

Open dashawk opened this issue 3 years ago • 2 comments
trafficstars

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.

image

OS: Windows 10 VSCode Version: 1.70.0 Node Version: 16.14.2

Reproduction

  1. Install Preview.js from the extensions tab.
  2. Restart VSCode IDE
  3. Create a new ReactJS from CRA or ViteJS
  4. 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

dashawk avatar Aug 08 '22 14:08 dashawk

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

dashawk avatar Aug 08 '22 14:08 dashawk

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?

fwouts avatar Aug 08 '22 23:08 fwouts

This is solved now that the status bar lets you choose "Open in external browser".

fwouts avatar Sep 12 '23 15:09 fwouts