Skip to content

fix: fix #6834 #6883

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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions packages/@vue/cli-service/lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const {
error,
hasProjectYarn,
hasProjectPnpm,
IpcMessenger
IpcMessenger,
openBrowser
} = require('@vue/cli-shared-utils')
const getBaseUrl = require('../util/getBaseUrl')

Expand Down Expand Up @@ -190,6 +191,8 @@ module.exports = (api, options) => {
process.exit(1)
})

const open = args.open || projectDevServerOptions.open

// create server
const server = new WebpackDevServer(Object.assign({
historyApiFallback: {
Expand Down Expand Up @@ -234,7 +237,7 @@ module.exports = (api, options) => {
...projectDevServerOptions.client
},

open: args.open || projectDevServerOptions.open,
// open,
setupExitSignals: true,

setupMiddlewares (middlewares, devServer) {
Expand Down Expand Up @@ -330,6 +333,9 @@ module.exports = (api, options) => {
const buildCommand = hasProjectYarn(api.getCwd()) ? `yarn build` : hasProjectPnpm(api.getCwd()) ? `pnpm run build` : `npm run build`
console.log(` Note that the development build is not optimized.`)
console.log(` To create a production build, run ${chalk.cyan(buildCommand)}.`)
if (open) {
openBrowser(urls.localUrlForTerminal)
}
} else {
console.log(` App is served in production mode.`)
console.log(` Note this is for preview or E2E testing only.`)
Expand Down