Skip to content

Commit

Permalink
fix open browser always (vuejs-templates#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiMaoYuan authored and yyx990803 committed Feb 3, 2017
1 parent 1f87b1e commit 097f268
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion template/build/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var webpackConfig = {{#if_or unit e2e}}process.env.NODE_ENV === 'testing'

// default port where dev server listens for incoming traffic
var port = process.env.PORT || config.dev.port
// automatically open browser, if not set will be false
var autoOpenBrowser = !!config.dev.autoOpenBrowser
// Define HTTP proxies to your custom API backend
// https://github.com/chimurai/http-proxy-middleware
var proxyTable = config.dev.proxyTable
Expand Down Expand Up @@ -75,7 +77,7 @@ module.exports = app.listen(port, function (err) {
}

// when env is testing, don't need open it
if (process.env.NODE_ENV !== 'testing') {
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
opn(uri)
}
})
1 change: 1 addition & 0 deletions template/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
dev: {
env: require('./dev.env'),
port: 8080,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
Expand Down

0 comments on commit 097f268

Please sign in to comment.