microsoft / vscode-livepreview

Hosts a local server in your workspace for you to preview your webpages.
http://aka.ms/live-preview
MIT License
387 stars 55 forks source link

just white,cannot work normal #627

Open chall1123 opened 4 months ago

chall1123 commented 4 months ago

image version 2024010901 vscode version 1.81.1

andreamah commented 4 months ago

Can you open the developer tools? In the command palette, run Developer: Toggle Developer Tools.

chall1123 commented 4 months ago

Can you open the developer tools? In the command palette, run Developer: Toggle Developer Tools. @andreamah i can open developer tools, i used remote ssh extension,vscode work in linux image

sultanmyrza commented 4 months ago

Same thing here

In the beginning live preview was working ok. However after finishing mdn PWA tutorial I started doing 2nd mdn PWA tutorial . I started by creating new directory and new index.hml

Here is the contents of index.html ```hml js13kGames A-Frame entries

js13kGames A-Frame entries

A-Frame category in the js13kGames 2017 competition. You can fork js13kPWA on GitHub to check its source code.

TODO: Content inserted in here
```

However when I start live preview I see white screen. I open dev tools and here is the screenshot

Screenshot 2024-03-30 at 5 08 08 PM

I know Live Preview is in "preview mode" but team already did a great job. And I really enjoy using it but can't use it now.

sultanmyrza commented 4 months ago

In my previous resonse it's using port :3000. And I change Live Preview to use port :3001 and it works as expected.

Screenshot 2024-03-30 at 7 33 25 PM

I can use Live Preview now however it's not best workaround since I will keep changin ports. Is there a way to clear Live Preview cache or something?

chall1123 commented 4 months ago

In my previous resonse it's using port :3000. And I change Live Preview to use port :3001 and it works as expected.

Screenshot 2024-03-30 at 7 33 25 PM

I can use Live Preview now however it's not best workaround since I will keep changin ports. Is there a way to clear Live Preview cache or something?

very good, I change Live Preview port number, my Live Preview extension can work normal,I hope your problem can also be solved

sultanmyrza commented 4 months ago

@chall1123, glad it worked for you but I still feel it's not good workaround and feels like I'm "polluting" ports. Rather it would be nice if there were better "right" solution.

andreamah commented 4 months ago

Perhaps this is a good use case of https://github.com/microsoft/vscode-livepreview/issues/333, where there would be auto-finding of an IP address to prevent collisions.

andreamah commented 4 months ago

Alternatively, you can select a different IP address in livePreview.hostIP if you can't anticipate a free port on 127.0.0.1. Although Live Preview should have its own logic to try not to occupy a port that is already being hosted on.