Skip to content

Commit

Permalink
feat(serve): support entry in vue-cli-service serve
Browse files Browse the repository at this point in the history
close #974
  • Loading branch information
yyx990803 committed May 3, 2018
1 parent 9766db1 commit 05f9f3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/@vue/cli-service/lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defaults = {
module.exports = (api, options) => {
api.registerCommand('serve', {
description: 'start development server',
usage: 'vue-cli-service serve [options]',
usage: 'vue-cli-service serve [options] [entry]',
options: {
'--open': `open browser on server start`,
'--mode': `specify env mode (default: development)`,
Expand Down Expand Up @@ -42,6 +42,13 @@ module.exports = (api, options) => {
// resolve webpack config
const webpackConfig = api.resolveWebpackConfig()

const entry = args._[0]
if (entry) {
webpackConfig.entry = {
app: api.resolve(entry)
}
}

// inject dev & hot-reload middleware entries
if (!isProduction) {
const devClients = [
Expand Down

1 comment on commit 05f9f3a

@dabernathy89
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI @yyx990803 - it seems that the --open option here expects an argument, so when I run this:

vue-cli-service serve --open src/serve.js

It passes the entry argument into --open. Instead I have to do this:

vue-cli-service serve --open foo src/serve.js

Please sign in to comment.