UNPKG

@roots/bud-extensions

Version:

bud.js core module

41 lines (40 loc) 1.16 kB
import { __decorate } from "tslib"; import { Extension } from '@roots/bud-framework/extension'; import { expose, label, options, plugin, } from '@roots/bud-framework/extension/decorators'; import { Plugin } from '@roots/bud-support/clean-webpack-plugin'; import isUndefined from '@roots/bud-support/isUndefined'; /** * Clean webpack plugin configuration */ let BudClean = class BudClean extends Extension { /** * {@link Extension.when} */ when(bud) { if (this.enabled === false) return false; if (!isUndefined(bud.context.clean)) return bud.context.clean; return bud.isProduction; } }; BudClean = __decorate([ label(`@roots/bud-extensions/clean-webpack-plugin`), expose(`clean`), plugin(Plugin), options({ /** * Clean before path patterns */ cleanOnceBeforeBuildPatterns: [`**/*`], /** * Clean stale assets */ cleanStaleWebpackAssets: true, /** * Protect webpack assets from accidental deletion */ protectWebpackAssets: true, }) ], BudClean); export default BudClean;