const rimraf = require('rimraf');
const fs = require('fs');
const webpackPaths = require('../configs/webpack.paths').default;

const foldersToRemove = [
  webpackPaths.distPath,
  webpackPaths.buildPath,
  webpackPaths.dllPath,
];

foldersToRemove.forEach((folder) => {
  if (fs.existsSync(folder)) {
    try {
      rimraf.sync(folder);
    } catch (error) {
      console.log(`Warning: Could not remove ${folder}:`, error.message);
    }
  }
});
