File tree 1 file changed +12
-1
lines changed
packages/@vuepress/core/lib/node
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
const { fs, path, chalk, logger } = require ( '@vuepress/shared-utils' )
2
2
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
+
3
13
/**
4
14
* Create a dynamic temp utility context that allow to lanuch
5
15
* multiple apps with isolated context at the same time.
@@ -19,8 +29,9 @@ module.exports = function createTemp (tempPath) {
19
29
20
30
if ( ! fs . existsSync ( tempPath ) ) {
21
31
fs . ensureDirSync ( tempPath )
22
- } else {
32
+ } else if ( ! alreadyEmptied ) {
23
33
fs . emptyDirSync ( tempPath )
34
+ alreadyEmptied = true
24
35
}
25
36
26
37
logger . debug ( `Temp directory: ${ chalk . gray ( tempPath ) } ` )
You can’t perform that action at this time.
0 commit comments