Skip to content

Commit

Permalink
fix($core): bust cache of extra watching files
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Jan 30, 2019
1 parent 2ca2611 commit 075f470
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@vuepress/core/lib/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ async function prepareServer (sourceDir, cliOptions = {}, context) {
}

// Curry update handler by update type
const spawnUpdate = (updateType) =>
file => update(`${chalk.red(updateType)} ${chalk.cyan(file)}`)
const spawnUpdate = updateType => file => {
const target = path.join(sourceDir, file)
// Bust cache.
delete require.cache[target]
update(`${chalk.red(updateType)} ${chalk.cyan(file)}`)
}

// watch add/remove of files
const pagesWatcher = chokidar.watch([
Expand Down

0 comments on commit 075f470

Please sign in to comment.