Skip to content

Commit 2f75769

Browse files
authoredJun 7, 2023
fix(build): use rimraf to handle temp folder deletion in windows (#2483)
1 parent 2bd55ec commit 2f75769

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

Diff for: ‎src/node/build/build.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import fs from 'fs-extra'
2-
import path from 'path'
2+
import { createRequire } from 'module'
33
import ora from 'ora'
4+
import path from 'path'
5+
import { packageDirectorySync } from 'pkg-dir'
6+
import { rimraf } from 'rimraf'
7+
import type { OutputAsset, OutputChunk } from 'rollup'
8+
import { pathToFileURL } from 'url'
49
import type { BuildOptions } from 'vite'
5-
import type { OutputChunk, OutputAsset } from 'rollup'
610
import { resolveConfig } from '../config'
7-
import { renderPage } from './render'
8-
import { bundle, okMark, failMark } from './bundle'
9-
import { createRequire } from 'module'
10-
import { pathToFileURL } from 'url'
11-
import { packageDirectorySync } from 'pkg-dir'
12-
import { serializeFunctions } from '../utils/fnSerialize'
1311
import type { HeadConfig } from '../shared'
12+
import { serializeFunctions } from '../utils/fnSerialize'
13+
import { bundle, failMark, okMark } from './bundle'
14+
import { renderPage } from './render'
1415

1516
export async function build(
1617
root?: string,
@@ -142,8 +143,7 @@ export async function build(
142143
)
143144
} finally {
144145
unlinkVue()
145-
if (!process.env.DEBUG)
146-
fs.rmSync(siteConfig.tempDir, { recursive: true, force: true })
146+
if (!process.env.DEBUG) await rimraf(siteConfig.tempDir)
147147
}
148148

149149
await siteConfig.buildEnd?.(siteConfig)

0 commit comments

Comments
 (0)