DEV Community

Cover image for how-to-test-local-website-on-your-phone by aryan
aryan015
aryan015

Posted on • Updated on

how-to-test-local-website-on-your-phone by aryan

vite

package.json

//change vite --host
'scripts':{
    'dev':'vite --host',
}
//initially vite runs on local server only.
Enter fullscreen mode Exit fullscreen mode
npm run dev #start vite server
Enter fullscreen mode Exit fullscreen mode

live server extension

If you are not using any framework then This extension might help.

//download live server on VSCode[available for other IDE]
//1. right click
//2. start live server
Enter fullscreen mode Exit fullscreen mode
ipconfig #windows
#copy ipv4 address with port number
#http://192.168.87.148:5173/
Enter fullscreen mode Exit fullscreen mode

create react app

npm start --host 192.168.1.111 # you can start custom react app using --host flag
Enter fullscreen mode Exit fullscreen mode

type on phone

#192.168.1.111:3000 # get your host on react terminal
Enter fullscreen mode Exit fullscreen mode

How to find your IP address

for mac

System Preferences can be accessed by opening the Apple menu.

Select Network from the View menu by opening it, or click Network in the System Preferences window.

On the left menu, select your network connection.

The local IP address for an Ethernet or USB connection will be displayed.

In the connection status section for a Wi-Fi connection, your IP address will be displayed.

for linux

ifconfig
Enter fullscreen mode Exit fullscreen mode

note: You must be on same network by either USB or wifi.

đź”—linkedin

learning resources

🧡Scaler - India's Leading software E-learning
🧡w3schools - for web developers

Top comments (0)