|
|
@@ -1,8 +1,9 @@
|
|
|
const webpack = require('webpack');
|
|
|
const chalk = require('chalk');
|
|
|
const config = require('../config/webpack.config');
|
|
|
-const {clearConsole} = require('./utils');
|
|
|
-const {errorLogger} = require('./utils');
|
|
|
+const {clearConsole, errorLogger} = require('./utils');
|
|
|
+const {outputPath} = require('../config/paths');
|
|
|
+const fs = require('fs-extra');
|
|
|
|
|
|
const MAX_CHUNK_SIZE = Number(process.env.MAX_CHUNK_SIZE ?? 0);
|
|
|
|
|
|
@@ -79,6 +80,9 @@ function printAssets(assets) {
|
|
|
}
|
|
|
try {
|
|
|
const compiler = webpack(config);
|
|
|
+
|
|
|
+ fs.emptyDirSync(outputPath);
|
|
|
+
|
|
|
compiler.run(function (err, stats) {
|
|
|
if (err) {
|
|
|
errorLogger('Failed to compile');
|