Skip to content

Commit

Permalink
Parcel only removes directory if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Dec 28, 2023
1 parent 8eab24e commit aaec08d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/parcelAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const optionsProd = {

function clearDirectory(relativePath) {
const dir = Path.join(__dirname, relativePath)
fs.rmSync(dir, { recursive: true })
if (fs.existsSync(dir)){
fs.rmSync(dir, { recursive: true })
}
if (!fs.existsSync(dir)){
fs.mkdirSync(dir)
}
Expand Down

0 comments on commit aaec08d

Please sign in to comment.