Access Webpack Dev Server from Mobile Safari on an iPhone

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 years ago

Testing your sites on mobile devices is a critical part of the development process. Webpack dev server enables you to visit the server from any device using the host option. This lesson walks you through accessing webpack dev server using an iPhone.

[00:00] Here I have a basic webpack project which I created with the view CLI. To be able to test this on my phone, I'm going to open my package.json and go into my scripts. This one's called dev, sometimes it's called start like create-react-app, and you'll see it just invokes webpack-dev-server with some options.

[00:18] I'm going to duplicate this script, and name this safari-dev, because I'm mostly concerned about mobile development on Safari, and then add the flag host 0000and port 3000, so I know exactly which port to open.

[00:37] Before I run this script, I need to check the IP of my computer on the network, so I'll do that with ifconfig, and you can see I'm at 192.168.1.17. This will be exposed on port 3000.

[00:50] If I run this yarn safari-dev, and it will say your project is running here, which means I can now access it from my network address. I'll launch this, and you can see my project running at this port.

[01:06] The next step before you can open this on your phone is to expose port 3000 through your firewall, and depending on your operating system whether Windows, or Mac, or Linux, it's just a simple thing to google, so look how to do that. Once other devices can access this, I'll show on my iPhone here if I go to this address, that it launches the page.

[01:25] If I come into my project, into one of my files, and I make a change like deleting this logo, hit delete, then save, you'll see it did the hot reload, and the logo disappeared.

egghead
egghead
~ 2 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today