2025-07-16 22:29:28 +08:00
|
|
|
"use strict";
|
|
|
|
|
2024-09-27 02:38:33 +08:00
|
|
|
const webpack = require("../../../../");
|
|
|
|
|
|
|
|
/** @type {import("../../../../").Configuration} */
|
|
|
|
module.exports = {
|
|
|
|
cache: {
|
|
|
|
type: "filesystem"
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /mod\.js$/,
|
|
|
|
use: "./loader"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
2025-10-03 02:55:56 +08:00
|
|
|
new webpack.ProgressPlugin(() => {}),
|
2024-09-27 02:38:33 +08:00
|
|
|
{
|
|
|
|
apply(compiler) {
|
|
|
|
compiler.hooks.done.tapPromise("CacheTest", async () => {
|
|
|
|
const cache = compiler
|
|
|
|
.getCache("ProgressPlugin")
|
|
|
|
.getItemCache("counts", null);
|
|
|
|
|
|
|
|
const data = await cache.getPromise();
|
|
|
|
|
|
|
|
if (data.modulesCount !== 4) {
|
|
|
|
throw new Error(
|
|
|
|
`Wrong cached value of \`ProgressPlugin.modulesCount\` - ${data.modulesCount}, expect 4`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.dependenciesCount !== 4) {
|
|
|
|
throw new Error(
|
|
|
|
`Wrong cached value of \`ProgressPlugin.dependenciesCount\` - ${data.dependenciesCount}, expect 4`
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|