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:
committed by
Jan Lysý
parent
b71f8defc8
commit
ea5bc1ab2c
@ -1,9 +1,9 @@
|
|||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const webpackManifestPlugin = require('webpack-manifest-plugin');
|
const webpackManifestPlugin = require('webpack-manifest-plugin');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
||||||
const webpackTerserPlugin = require('terser-webpack-plugin');
|
const webpackTerserPlugin = require('terser-webpack-plugin');
|
||||||
const webpackCopyPlugin = require('copy-webpack-plugin');
|
const webpackCopyPlugin = require('copy-webpack-plugin');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const del = require('del');
|
||||||
const globalPrefix = 'MailPoetLib';
|
const globalPrefix = 'MailPoetLib';
|
||||||
const PRODUCTION_ENV = process.env.NODE_ENV === 'production';
|
const PRODUCTION_ENV = process.env.NODE_ENV === 'production';
|
||||||
const manifestSeed = {};
|
const manifestSeed = {};
|
||||||
@ -58,9 +58,7 @@ const baseConfig = {
|
|||||||
node: {
|
node: {
|
||||||
fs: 'empty'
|
fs: 'empty'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [],
|
||||||
new CleanWebpackPlugin(),
|
|
||||||
],
|
|
||||||
module: {
|
module: {
|
||||||
noParse: /node_modules\/lodash\/lodash\.js/,
|
noParse: /node_modules\/lodash\/lodash\.js/,
|
||||||
rules: [
|
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);
|
return Object.assign({}, baseConfig, config);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user