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

Make launching the browser in serve-dev optional #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Templates/VueJsWebpack/build/serve-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var config = require('../config');
var open = require('opener');

var port = process.env.PORT || config.dev.port;
var launchBrowser = config.dev.launchBrowser;

function checkConnection(host, port, timeout) {
return new Promise(function (resolve, reject) {
Expand All @@ -25,12 +26,16 @@ function checkConnection(host, port, timeout) {
}

checkConnection("localhost", port, 1000).then(function () {
var p = open("http://localhost:" + port, function () {
console.log("Server already running. Opening browser...");
});
if (launchBrowser) {
var p = open("http://localhost:" + port, function () {
console.log("Server already running. Opening browser...");
});
}

}, function (err) {
// if port isn't open, run the dev-server that opens it
var server = require('./dev-server');
open("http://localhost:" + port);
if (launchBrowser) {
open("http://localhost:" + port);
}
});
3 changes: 2 additions & 1 deletion Templates/VueJsWebpack/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
dev: {
env: require('./dev.env'),
port: 8080,
proxyTable: {}
proxyTable: {},
launchBrowser: true
}
}