previewjs icon indicating copy to clipboard operation
previewjs copied to clipboard

Visual Studio Code Remote support

Open akatsukilevi opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. It is related to a issue I noticed. If you use it with a remote ssh server, the preview still tries to connect to your localhost, which results with a blank page(since the port isn't accessible on your localhost, but yes the remote server localhost).

Describe the solution you'd like I noticed that forwarding the port 3140 through VS Code's Built-in Port Forwarder does indeed solve the issue and I'm able to use it with no issues. Maybe it could setup this port forward automatically?

Describe alternatives you've considered One alternative would be to use the host IP address(yet some people use theses servers outside of intranet and opening a port like this could be a security risk. Port forward sounds more secure than normal open port

Additional context I only used Remote development through SSH with the React Preview. Haven't tested with containers, I believe it could end up on the same thought

akatsukilevi avatar Dec 10 '21 12:12 akatsukilevi

Hey @akatsukilevi, thanks for flagging this. It's an issue I'm well aware of but as far as I know, VS Code doesn't expose an API to set up the port forwarding automatically. Keeping this open in case someone finds a solution :)

fwouts avatar Dec 13 '21 04:12 fwouts

This weekend now(18/19) I can take a look at how the port forwarding on VS Code works, maybe there is a easy way to do it? I know that, if you have remote.autoForwardPorts active(which is default) and the terminal outputs a url with a port(example, http://localhost:3000), VS Code automatically open a forwarded port. Maybe worth to check this?

akatsukilevi avatar Dec 13 '21 11:12 akatsukilevi

@akatsukilevi thanks for offering! I'm releasing an open source version of React Preview in the next few weeks (will be called Preview.js as it won't be just React anymore), maybe best to wait until that's out there so you can play around with it more easily 🙂

fwouts avatar Dec 13 '21 20:12 fwouts

Did you make any progress on this? I am experiencing it as well..

kristiandupont avatar May 13 '22 20:05 kristiandupont

Sorry @kristiandupont, no progress yet but thanks for raising the issue again. Up in the priority list 🙂

fwouts avatar May 13 '22 21:05 fwouts