Skip to content

Commit

Permalink
build(client): cleanup existing bundle file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhang1030 authored Dec 20, 2023
1 parent 1463761 commit b047905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default defineConfig(mergeConfig(baseConfig, {
// Removed `browser-extension` and `electron` on `build:lib`
// Remove `vite/dist/client` on building
;['../vite/dist/client'].forEach((dir) => {
fse.rmSync(resolve(__dirname, dir), { recursive: true, force: true })
const absoluteDir = resolve(__dirname, dir)
if (fse.existsSync(absoluteDir))
fse.removeSync(absoluteDir)
})

;['../browser-extension/client', '../electron/client', '../vite/dist/client'].forEach((dir) => {
Expand Down
6 changes: 4 additions & 2 deletions packages/client/vite.lib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export default defineConfig(mergeConfig(baseConfig, {
;['../browser-extension/client', '../electron/client'].forEach((dir) => {
// NOTE: remember the order of `build:lib` and `build`,
// if change the order, rmSync must set in `build` stage
fse.rmSync(resolve(__dirname, dir), { recursive: true, force: true })
fse.copySync(clientFile, resolve(__dirname, dir))
const absoluteDir = resolve(__dirname, dir)
if (fse.existsSync(absoluteDir))
fse.removeSync(absoluteDir)
fse.copySync(clientFile, absoluteDir)
})
},
},
Expand Down

0 comments on commit b047905

Please sign in to comment.