File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/@vuepress/core/lib/node Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11const { fs, path, chalk, logger } = require ( '@vuepress/shared-utils' )
22
3+ // Only empty the `.temp` directory at most once per run to avoid
4+ // compilation errors caused by removed files.
5+ // See: https://github.com/vuejs/vuepress/issues/2254#issuecomment-689457157
6+ //
7+ // Known issue: This can cause the `.temp` directory to grow while the server
8+ // is running, but the impact is limited because the `.temp` directory will
9+ // be cleared when restarting the server.
10+ // See discussion in https://github.com/vuejs/vuepress/pull/2612
11+ let alreadyEmptied = false
12+
313/**
414 * Create a dynamic temp utility context that allow to lanuch
515 * multiple apps with isolated context at the same time.
@@ -19,8 +29,9 @@ module.exports = function createTemp (tempPath) {
1929
2030 if ( ! fs . existsSync ( tempPath ) ) {
2131 fs . ensureDirSync ( tempPath )
22- } else {
32+ } else if ( ! alreadyEmptied ) {
2333 fs . emptyDirSync ( tempPath )
34+ alreadyEmptied = true
2435 }
2536
2637 logger . debug ( `Temp directory: ${ chalk . gray ( tempPath ) } ` )
You can’t perform that action at this time.
0 commit comments