Replace webpack cleanup plugin with simple deletion

The cleanup plugin was not working properly as it is not designed for multi config environments.
It deleted tests assets after they were built.
[MAILPOET-3673]
This commit is contained in:
Rostislav Wolny
2021-06-30 16:18:27 +02:00
committed by Jan Lysý
parent b71f8defc8
commit ea5bc1ab2c

View File

@ -1,9 +1,9 @@
const webpack = require('webpack');
const webpackManifestPlugin = require('webpack-manifest-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const webpackTerserPlugin = require('terser-webpack-plugin');
const webpackCopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const del = require('del');
const globalPrefix = 'MailPoetLib';
const PRODUCTION_ENV = process.env.NODE_ENV === 'production';
const manifestSeed = {};
@ -58,9 +58,7 @@ const baseConfig = {
node: {
fs: 'empty'
},
plugins: [
new CleanWebpackPlugin(),
],
plugins: [],
module: {
noParse: /node_modules\/lodash\/lodash\.js/,
rules: [
@ -407,5 +405,9 @@ module.exports = [adminConfig, publicConfig, migratorConfig, formEditorConfig, f
})
);
}
// Clean output paths before build
if (config.output && config.output.path) {
del.sync([path.resolve(config.output.path, '**/*')]);
}
return Object.assign({}, baseConfig, config);
});