webpack/test/configCases/cache-filesystem/multicompiler-mode-cache-3/webpack.config.js

72 lines
1.5 KiB
JavaScript
Raw Normal View History

"use strict";
2025-05-01 22:36:51 +08:00
/** @typedef {import("../../../../").Compiler} Compiler */
/** @typedef {import("../../../../").FileCacheOptions} FileCacheOptions */
2024-05-01 19:33:16 +08:00
// with explicit cache names
/** @type {import("../../../../").Configuration} */
module.exports = [
{
mode: "production",
entry: "./index",
cache: {
2024-05-01 19:33:16 +08:00
name: "filesystem",
type: "filesystem"
2024-07-31 23:35:50 +08:00
},
plugins: [
{
2025-05-01 22:36:51 +08:00
/**
* @param {Compiler} compiler compiler
*/
2024-07-31 23:35:50 +08:00
apply(compiler) {
compiler.hooks.environment.tap("FixTestCachePlugin", () => {
2025-05-01 22:36:51 +08:00
/** @type {FileCacheOptions} */
(compiler.options.cache).cacheLocation =
/** @type {string} */
(
/** @type {FileCacheOptions} */
(compiler.options.cache).cacheLocation
).replace(/filesystem$/, "filesystem-extra-1");
2024-07-31 23:35:50 +08:00
});
}
}
]
},
{
mode: "production",
entry: "./index",
cache: {
2024-05-01 19:33:16 +08:00
name: "filesystem",
type: "filesystem"
2024-07-31 23:35:50 +08:00
},
plugins: [
{
2025-05-01 22:36:51 +08:00
/**
* @param {Compiler} compiler compiler
*/
2024-07-31 23:35:50 +08:00
apply(compiler) {
compiler.hooks.environment.tap("FixTestCachePlugin", () => {
2025-05-01 22:36:51 +08:00
/** @type {FileCacheOptions} */
(compiler.options.cache).cacheLocation =
/** @type {string} */
(
/** @type {FileCacheOptions} */
(compiler.options.cache).cacheLocation
).replace(/filesystem$/, "filesystem-extra-2");
2024-07-31 23:35:50 +08:00
});
}
}
]
},
{
name: "3rd compiler",
mode: "production",
entry: "./index",
cache: {
2024-05-01 19:33:16 +08:00
name: "filesystem",
type: "filesystem"
}
}
];