Skip to content

Commit 075f470

Browse files
committed
fix($core): bust cache of extra watching files
1 parent 2ca2611 commit 075f470

File tree

1 file changed

+6
-2
lines changed
  • packages/@vuepress/core/lib

1 file changed

+6
-2
lines changed

packages/@vuepress/core/lib/dev.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ async function prepareServer (sourceDir, cliOptions = {}, context) {
3737
}
3838

3939
// Curry update handler by update type
40-
const spawnUpdate = (updateType) =>
41-
file => update(`${chalk.red(updateType)} ${chalk.cyan(file)}`)
40+
const spawnUpdate = updateType => file => {
41+
const target = path.join(sourceDir, file)
42+
// Bust cache.
43+
delete require.cache[target]
44+
update(`${chalk.red(updateType)} ${chalk.cyan(file)}`)
45+
}
4246

4347
// watch add/remove of files
4448
const pagesWatcher = chokidar.watch([

0 commit comments

Comments
 (0)