webpack clean up old packaging resource plugin

When we modify a file with hash and packaged, each package once it will generate a new file, the old file is not deleted. To address this situation, we can use the clean-webpack-plugin before you package the files to clear, and then after the latest package of documents

installation

npm install clean-webpack-plugin --save-dev

Configuration

const {CleanWebpackPlugin}=require('clean-webpack-plugin');

module.exports={
    plugins=[
        new CleanWebpackPlugin()
    ]
}

use

Configured, take effect automatically when packaging

Guess you like

Origin www.cnblogs.com/roseAT/p/12088762.html
Recommended