Skip to content

Commit

Permalink
Support error handling for clean-hot-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Sep 20, 2024
1 parent e623131 commit 04f0546
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions programs/develop/webpack/plugin-compilation/clean-hot-updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export class CleanHotUpdatesPlugin {
const hotUpdatePath = path.join(compiler.options.output.path || '', 'hot')

if (fs.existsSync(hotUpdatePath)) {
fs.rmdirSync(hotUpdatePath, {recursive: true})
if (process.env.EXTENSION_ENV === 'development') {
console.log(
'[CleanHotUpdatesPlugin] Removed old hot-update files before compilation.'
try {
fs.rmSync(hotUpdatePath, {recursive: true, force: true})
if (process.env.EXTENSION_ENV === 'development') {
console.log(
'[CleanHotUpdatesPlugin] Removed old hot-update files before compilation.'
)
}
} catch (error: any) {
console.error(
`[CleanHotUpdatesPlugin] Failed to remove hot-update files: ${error.message}`
)
}
}
Expand Down

0 comments on commit 04f0546

Please sign in to comment.