feat: remove/clean your build folder(s) before building

This commit is contained in:
endiliey 2018-08-23 23:07:24 +08:00
parent 406106b67e
commit e13e1bffb4
3 changed files with 13 additions and 0 deletions

View file

@ -1,6 +1,7 @@
const path = require('path');
const webpackNiceLog = require('webpack-nicelog');
const {StatsWriterPlugin} = require('webpack-stats-plugin');
const cleanWebpackPlugin = require('clean-webpack-plugin');
const createBaseConfig = require('./base');
module.exports = function createClientConfig(props) {
@ -8,6 +9,11 @@ module.exports = function createClientConfig(props) {
config.entry('main').add(path.resolve(__dirname, '../core/clientEntry.js'));
const {outDir} = props;
config
.plugin('clean')
.use(cleanWebpackPlugin, [outDir, {verbose: false, allowExternal: true}]);
// write webpack stats object to a file so we can
// programmatically refer to the correct bundle path in Node.js server.
config