Skip to content

Add watch mode #305

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

Closed
wants to merge 1 commit into from
Closed
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: 11 additions & 2 deletions bin/vue-build
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ program
.option('-o, --open', 'Open browser')
.option('--proxy [url]', 'Proxy API request')
.option('--lib [libraryName]', 'Distribute component in UMD format')
.option('--watch', 'Run in watch mode')
.parse(process.argv)

var args = program.args
Expand Down Expand Up @@ -73,7 +74,8 @@ var options = merge({
mount: program.mount,
proxy: program.proxy,
production: program.production,
lib: program.lib
lib: program.lib,
watch: program.watch
})

function help () {
Expand Down Expand Up @@ -189,7 +191,8 @@ var webpackConfig = {
babel: babelOptions
}
})
]
],
watch: options.watch
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to set this?

}

// if entry ends with `.vue` and no `mount` option was specified
Expand Down Expand Up @@ -290,6 +293,12 @@ if (!options.disableWebpackConfig) {

try {
var compiler = webpack(webpackConfig)

if (options.watch) {
compiler.watch({
Copy link
Collaborator

Choose a reason for hiding this comment

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

should replace the compiler.run below with this

aggregateTimeout: 300
}, () => null)
}
} catch (err) {
if (err.name === 'WebpackOptionsValidationError') {
logger.fatal(err.message)
Expand Down