Skip to content

Commit

Permalink
fix: Unexpected temporary file #13267
Browse files Browse the repository at this point in the history
  • Loading branch information
s10y10 committed May 19, 2023
1 parent 3f3fff2 commit 512deef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,14 @@ async function loadConfigFromBundledFile(
// with --experimental-loader themselves, we have to do a hack here:
// write it to disk, load it with native Node ESM, then delete the file.
if (isESM) {
// check and clear legacy Tmp files
const fileBaseName = path.basename(fileName)
const fileDir = path.dirname(fileName)
const timestampFiles = (await fsp.readdir(fileDir)).filter(name=>name.includes(`${fileBaseName}.timestamp-`))
timestampFiles.forEach(name=>{
fs.unlink(path.resolve(fileDir,name), () => { });
})

const fileBase = `${fileName}.timestamp-${Date.now()}-${Math.random()
.toString(16)
.slice(2)}`
Expand Down

0 comments on commit 512deef

Please sign in to comment.