Replace clean-webpack-plugin with initial cleanup in Robofile

We need to share the same output path (assets/build/js) in more configs
in order to generate a common manifest.json file.
The cleanup plugin and also build-in output.clean setting do the cleanup on emit
and that causes that they delete files we want to keep.
Using different output paths solves the problem with cleanup but it causes that we generate a bunch of manifest.json files
instead of one.
As simplest workaround I chose cleaning the output directory before we trigger the Webpack build in the Robofile.
[MAILPOET-3214]
This commit is contained in:
Rostislav Wolny
2021-09-16 10:02:28 +02:00
committed by Veljko V
parent 85c4aa7aa1
commit dac4fb5dd0
4 changed files with 1 additions and 250 deletions

View File

@ -66,6 +66,7 @@ class RoboFile extends \Robo\Tasks {
if (!is_dir('assets/dist/js')) {
mkdir('assets/dist/js', 0777, true);
}
$this->_exec('rm -rf ' . __DIR__ . '/assets/dist/js/*');
$env = ($opts['env']) ?
sprintf('./node_modules/.bin/cross-env NODE_ENV="%s"', $opts['env']) :
null;