fix(build): use rimraf to handle temp folder deletion in windows (#2483)

pull/2484/head
Divyansh Singh 1 year ago committed by GitHub
parent 2bd55eca2e
commit 2f75769985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,16 +1,17 @@
import fs from 'fs-extra'
import path from 'path'
import { createRequire } from 'module'
import ora from 'ora'
import path from 'path'
import { packageDirectorySync } from 'pkg-dir'
import { rimraf } from 'rimraf'
import type { OutputAsset, OutputChunk } from 'rollup'
import { pathToFileURL } from 'url'
import type { BuildOptions } from 'vite'
import type { OutputChunk, OutputAsset } from 'rollup'
import { resolveConfig } from '../config'
import { renderPage } from './render'
import { bundle, okMark, failMark } from './bundle'
import { createRequire } from 'module'
import { pathToFileURL } from 'url'
import { packageDirectorySync } from 'pkg-dir'
import { serializeFunctions } from '../utils/fnSerialize'
import type { HeadConfig } from '../shared'
import { serializeFunctions } from '../utils/fnSerialize'
import { bundle, failMark, okMark } from './bundle'
import { renderPage } from './render'
export async function build(
root?: string,
@ -142,8 +143,7 @@ export async function build(
)
} finally {
unlinkVue()
if (!process.env.DEBUG)
fs.rmSync(siteConfig.tempDir, { recursive: true, force: true })
if (!process.env.DEBUG) await rimraf(siteConfig.tempDir)
}
await siteConfig.buildEnd?.(siteConfig)

Loading…
Cancel
Save