diff --git a/lib/build.js b/lib/build.js index cc7b0b30d1..f683af0fa6 100644 --- a/lib/build.js +++ b/lib/build.js @@ -513,7 +513,7 @@ function watchPages () { r(this.srcDir, 'pages/**/*.vue'), r(this.srcDir, 'layouts/*.vue'), r(this.srcDir, 'layouts/**/*.vue') - ].concat(this.options.build.watch) + ] const options = Object.assign({}, this.options.watchers.chokidar, { ignoreInitial: true }) @@ -521,7 +521,11 @@ function watchPages () { const refreshFiles = _.debounce(() => { co(generateRoutesAndFiles.bind(this)) }, 200) - this.pagesFilesWatcher = chokidar.watch(_.uniq(patterns), options) + // Watch for internals + this.pagesFilesWatcher = chokidar.watch(patterns, options) .on('add', refreshFiles) .on('unlink', refreshFiles) + // Watch for custom provided files + this.customFilesWatcher = chokidar.watch(_.uniq(this.options.build.watch), options) + .on('change', refreshFiles) }