mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-27 20:29:01 +08:00
fix: 修复清除webpack-cache问题
This commit is contained in:
parent
cc20923e07
commit
df78d1dcac
@ -1,19 +1,22 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
async function handleCacheClean(cwd) {
|
async function handleCacheClean(cwd) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const cachePath = path.join(cwd, '.cache/webpack');
|
const cachePath = path.join(cwd, '.cache/webpack');
|
||||||
require('get-folder-size')(cachePath, (err, size) => {
|
if (fs.existsSync(cachePath)) {
|
||||||
if (err) {
|
require('get-folder-size')(cachePath, (err, size) => {
|
||||||
return reject(err);
|
if (err) {
|
||||||
}
|
return reject(err);
|
||||||
// 大于 5G 清除缓存,修复 webpack 缓存无限增长问题
|
}
|
||||||
// https://github.com/webpack/webpack/issues/13291
|
// 大于 5G 清除缓存,修复 webpack 缓存无限增长问题
|
||||||
if (size > 5 * 1024 * 1024 * 1024) {
|
// https://github.com/webpack/webpack/issues/13291
|
||||||
require('fs-extra').removeSync(cachePath);
|
if (size > 5 * 1024 * 1024 * 1024) {
|
||||||
}
|
require('fs-extra').removeSync(cachePath);
|
||||||
resolve(size);
|
}
|
||||||
});
|
resolve(size);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user