Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prefer devServer.public as the custom url for browser to open (#4169) #4169

Merged
merged 1 commit into from Jun 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/@vue/cli-service/lib/commands/serve.js
Expand Up @@ -92,6 +92,7 @@ module.exports = (api, options) => {
port,
isAbsoluteUrl(options.publicPath) ? '/' : options.publicPath
)
const localUrlForBrowser = publicUrl || urls.localUrlForBrowser

const proxySettings = prepareProxy(
projectDevServerOptions.proxy,
Expand Down Expand Up @@ -201,7 +202,7 @@ module.exports = (api, options) => {
let copied = ''
if (isFirstCompile && args.copy) {
try {
require('clipboardy').writeSync(urls.localUrlForBrowser)
require('clipboardy').writeSync(localUrlForBrowser)
copied = chalk.dim('(copied to clipboard)')
} catch (_) {
/* catch exception if copy to clipboard isn't supported (e.g. WSL), see issue #3476 */
Expand Down Expand Up @@ -250,15 +251,15 @@ module.exports = (api, options) => {
const pageUri = (projectDevServerOptions.openPage && typeof projectDevServerOptions.openPage === 'string')
? projectDevServerOptions.openPage
: ''
openBrowser(urls.localUrlForBrowser + pageUri)
openBrowser(localUrlForBrowser + pageUri)
}

// Send final app URL
if (args.dashboard) {
const ipc = new IpcMessenger()
ipc.send({
vueServe: {
url: urls.localUrlForBrowser
url: localUrlForBrowser
}
})
}
Expand All @@ -267,7 +268,7 @@ module.exports = (api, options) => {
// so other commands can do api.service.run('serve').then(...)
resolve({
server,
url: urls.localUrlForBrowser
url: localUrlForBrowser
})
} else if (process.env.VUE_CLI_TEST) {
// signal for test to check HMR
Expand Down