mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-22 12:28:44 -05:00
feat(build): add 'watch' option (#1332)
This commit is contained in:
@@ -104,6 +104,7 @@ Options:
|
||||
--dest specify output directory (default: dist)
|
||||
--target app | lib | wc | wc-async (default: app)
|
||||
--name name for lib or web-component mode (default: "name" in package.json or entry filename)
|
||||
--watch watch for changes
|
||||
```
|
||||
|
||||
`vue-cli-service build` produces a production-ready bundle in the `dist/` directory, with minification for JS/CSS/HTML and auto vendor chunk splitting for better caching. The chunk manifest is inlined into the HTML.
|
||||
|
||||
@@ -17,7 +17,8 @@ module.exports = (api, options) => {
|
||||
'--mode': `specify env mode (default: production)`,
|
||||
'--dest': `specify output directory (default: ${options.outputDir})`,
|
||||
'--target': `app | lib | wc | wc-async (default: ${defaults.target})`,
|
||||
'--name': `name for lib or web-component mode (default: "name" in package.json or entry filename)`
|
||||
'--name': `name for lib or web-component mode (default: "name" in package.json or entry filename)`,
|
||||
'--watch': `watch for changes`
|
||||
}
|
||||
}, async function build (args) {
|
||||
args.entry = args.entry || args._[0]
|
||||
@@ -100,8 +101,12 @@ module.exports = (api, options) => {
|
||||
: webpackConfig
|
||||
).output.path
|
||||
|
||||
if (args.watch) {
|
||||
webpackConfig.watch = true
|
||||
}
|
||||
|
||||
if (!args.dest && actualTargetDir !== api.resolve(options.outputDir)) {
|
||||
// user directly modifys output.path in configureWebpack or chainWebpack.
|
||||
// user directly modifies output.path in configureWebpack or chainWebpack.
|
||||
// this is not supported because there's no way for us to give copy
|
||||
// plugin the correct value this way.
|
||||
console.error(chalk.red(
|
||||
|
||||
Reference in New Issue
Block a user