Automatically empty the output.dir
folder before writing a new bundle.
Use this plugin with the bundler Rollup.
$ npm i rollup-plugin-clean-dir -D
// rollup.config.js
import { cleanDir } from 'rollup-plugin-clean-dir'
export default {
input: '....',
output: {
dir: '...',
},
plugins: [cleanDir()]
}
This Rollup plugin has no options, it just empties the dir
folder during the build process, right before Rollup writes any files.
TypeScript definitions are included, so no need to install an additional @types
library!