@@ -26,7 +26,6 @@ import webpack from 'webpack';
2626import { merge as webpackMerge } from 'webpack-merge' ;
2727
2828// webpack plugins
29- import { CleanWebpackPlugin } from 'clean-webpack-plugin' ;
3029import HtmlWebpackPlugin from 'html-webpack-plugin' ;
3130import StatsPlugin from 'stats-webpack-plugin' ;
3231import TerserPlugin from 'terser-webpack-plugin' ;
@@ -256,12 +255,18 @@ export async function bundle(options = {}) {
256255 webpackDefinePlugin . push ( new webpack . DefinePlugin ( defines ) ) ;
257256
258257 // clean mode
259- const webpackCleanPlugin = [ ] ;
258+ const webpackCleanOptions = { } ;
260259 if ( command . webpackClean === 'true' ) {
261- const opts = {
262- verbose : command . webpackCleanVerbose === 'true'
263- } ;
264- webpackCleanPlugin . push ( new CleanWebpackPlugin ( opts ) ) ;
260+ if ( command . webpackCleanVerbose === 'true' ) {
261+ webpackCleanOptions . clean = {
262+ keep ( asset ) {
263+ console . warn ( `clean-webpack-plugin: removed ${ asset } ` ) ;
264+ return false ;
265+ }
266+ } ;
267+ } else {
268+ webpackCleanOptions . clean = true ;
269+ }
265270 }
266271
267272 // html webpack plugin
@@ -291,7 +296,8 @@ export async function bundle(options = {}) {
291296 output : {
292297 path : path . join ( paths . local , 'js' ) ,
293298 publicPath : path . join ( paths . public , 'js/' ) ,
294- filename : '[name].[hash].js'
299+ filename : '[name].[hash].js' ,
300+ ...webpackCleanOptions
295301 } ,
296302 resolve : {
297303 alias : {
@@ -417,7 +423,6 @@ export async function bundle(options = {}) {
417423 plugins : [
418424 ...webpackHtmlPlugin ,
419425 ...webpackDefinePlugin ,
420- ...webpackCleanPlugin ,
421426 new VueLoaderPlugin ( ) ,
422427 ...webpackProgressPlugin ,
423428 ...webpackHmrPlugin
0 commit comments