Style missing on mobile

Hi @ben,

Any suggestions how to tackle this? Would be nice if this works out of the box.
Thanks for the help once again.

Hi @chrisgo,

One idea is to fetch an address at runtime. Here’s a quick function to pluck an IP address from interface name and family:

function getInterfaceIP(interface = 'eth0', family = 'IPv4') {
    const os = require('os');
    return os.networkInterfaces()[interface]?.reduce((c, o) => { if(o.family === family) { c.push(o) }; return c; }, [])[0]?.address;
}

So you could use something like:

.serve(`http://${getInterfaceIP() ?? '0.0.0.0'}:3000`)

I’ve just written that helper without really testing fully, so use with caution.

2 Likes

Hi @talss89,

Thanks for the effort! Sadly this doesn’t work anymore with Bud version 6.12.2. I hope this will work once again out of the box. This was the plan right @ben?

I really like developing with Sage but I’m running into this issue almost every update.

What does “doesn’t work anymore” mean?

In what version does it stop working? 6.12.1? 6.12.0? Earlier?

Well ‘doesn’t work anymore’ means I get some errors when adding his solution to the config. Before that I used other solutions from you in this topic to get this done. But ever since Browser Sync was removed I’m having issues to see my project on various systems or networks.

Is it old fashioned to view your project on a phone for example? If there are better alternatives then I would like to hear it. But I think adds value to Sage if we can view the project on our phone (for example) like we did in the past.

I’m not spending any more time on this topic. Saying that you “get some errors” and not providing them is a a complete waste of time. I’m not gonna do this back-and-forth with you.

I’d suggest simply using BrowserSync.