Skip to content

Commit

Permalink
fix: check if _dist folder exists before removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
ojvribeiro committed Sep 16, 2024
1 parent 190d72f commit 72df86a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,15 @@ class VulmixInit {
*/
if (mix.inProduction()) {
try {
console.log(`\n${chalk.grey('Removing _dist folder')}`)

fs.rmSync(`${ABSOLUTE_ROOT_PATH}/_dist`, {
recursive: true,
force: true,
})
if (fs.existsSync(`${ABSOLUTE_ROOT_PATH}/_dist`)) {
console.log(`\n${chalk.grey('Removing _dist folder')}`)

fs.rmSync(`${ABSOLUTE_ROOT_PATH}/_dist`, {
recursive: true,
force: true,
})
}

if (fs.existsSync(APP_PUBLIC_PATH)) {
mix.copy(APP_PUBLIC_PATH, `${ABSOLUTE_ROOT_PATH}/_dist/`)
Expand Down

0 comments on commit 72df86a

Please sign in to comment.