mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-21 12:05:24 -04:00
add clean-webpack-plugin to remove out. Signed-off-by: lihong <lihong67@huawei.com> Change-Id: I1bbae4d0df7fb924f695abc76c45a786c0ff81b6
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const CopyPlugin = require('copy-webpack-plugin');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const Webpack = require('webpack');
|
||||
const { GenAbcPlugin } = require('./lib/gen_abc_plugin');
|
||||
const buildPipeServer = require('./server/build_pipe_server');
|
||||
@@ -301,6 +302,25 @@ function setOptimizationConfig(config, workerFile) {
|
||||
}
|
||||
}
|
||||
|
||||
function setCleanWebpackPlugin(workerFile, config) {
|
||||
const cleanPath = [];
|
||||
cleanPath.push(projectConfig.buildPath);
|
||||
if (workerFile) {
|
||||
const workerFilesPath = Object.keys(workerFile);
|
||||
for (const workerFilePath of workerFilesPath) {
|
||||
cleanPath.push(path.resolve(projectConfig.buildPath, workerFilePath, '..'));
|
||||
}
|
||||
}
|
||||
|
||||
config.plugins.push(
|
||||
new CleanWebpackPlugin({
|
||||
dry: false,
|
||||
dangerouslyAllowCleanPatternsOutsideProject: true,
|
||||
cleanOnceBeforeBuildPatterns: cleanPath
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
const config = {};
|
||||
setProjectConfig(env);
|
||||
@@ -309,6 +329,7 @@ module.exports = (env, argv) => {
|
||||
const workerFile = readWorkerFile();
|
||||
setOptimizationConfig(config, workerFile);
|
||||
setCopyPluginConfig(config);
|
||||
setCleanWebpackPlugin(workerFile, config);
|
||||
if (env.isPreview !== "true") {
|
||||
loadWorker(projectConfig, workerFile);
|
||||
if (env.compilerType && env.compilerType === 'ark') {
|
||||
|
||||
Reference in New Issue
Block a user