diff --git a/lib/server.js b/lib/server.js index 8169db0..cfdce60 100644 --- a/lib/server.js +++ b/lib/server.js @@ -6,7 +6,6 @@ const { underline } = require('picocolors'); const Promise = require('bluebird'); const open = require('open'); const net = require('net'); -const url = require('url'); module.exports = function(args) { const app = connect(); @@ -76,5 +75,6 @@ function formatAddress(ip, port, root) { hostname = 'localhost'; } - return url.format({protocol: 'http', hostname: hostname, port: port, path: root}); + let path = root.startsWith("/") ? root : `/${root}`; + return new URL(`http://${hostname}:${port}${path}`).toString(); }