Skip to content

Commit 512deef

Browse files
committed
fix: Unexpected temporary file #13267
1 parent 3f3fff2 commit 512deef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/vite/src/node/config.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,14 @@ async function loadConfigFromBundledFile(
10931093
// with --experimental-loader themselves, we have to do a hack here:
10941094
// write it to disk, load it with native Node ESM, then delete the file.
10951095
if (isESM) {
1096+
// check and clear legacy Tmp files
1097+
const fileBaseName = path.basename(fileName)
1098+
const fileDir = path.dirname(fileName)
1099+
const timestampFiles = (await fsp.readdir(fileDir)).filter(name=>name.includes(`${fileBaseName}.timestamp-`))
1100+
timestampFiles.forEach(name=>{
1101+
fs.unlink(path.resolve(fileDir,name), () => { });
1102+
})
1103+
10961104
const fileBase = `${fileName}.timestamp-${Date.now()}-${Math.random()
10971105
.toString(16)
10981106
.slice(2)}`

0 commit comments

Comments
 (0)