chore: fix lint
Github Actions / lint (push) Has been cancelled Details
Github Actions / validate-legacy-node (push) Has been cancelled Details
Github Actions / benchmark (1/4) (push) Has been cancelled Details
Github Actions / benchmark (2/4) (push) Has been cancelled Details
Github Actions / benchmark (3/4) (push) Has been cancelled Details
Github Actions / benchmark (4/4) (push) Has been cancelled Details
Github Actions / basic (push) Has been cancelled Details
Github Actions / unit (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Has been cancelled Details

This commit is contained in:
Xiao 2025-07-30 18:12:32 +08:00 committed by GitHub
parent d2d34e6267
commit de79ee457e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 62 additions and 67 deletions

View File

@ -5,77 +5,72 @@ const { Compilation } = require("../../../../");
/** @type {import("../../../../").Configuration} */
module.exports = {
plugins: [
{
apply: (compiler) => {
compiler.hooks.compilation.tap(
"MockWebpackManifestPlugin",
(compilation) => {
compilation.hooks.processAssets.tap(
{
name: "MockWebpackManifestPlugin",
stage: Infinity
},
() => {
const manifest = {
"main.js": "/main.js",
"main.js.map": "/main.js.map"
};
compilation.emitAsset(
"asset-manifest.json",
new (require("../../../../").sources.RawSource)(
JSON.stringify(manifest, null, 2)
)
);
}
);
}
);
}
},
{
apply: (compiler) => {
compiler.hooks.compilation.tap(
"MockCompressionPlugin",
(compilation) => {
compilation.hooks.processAssets.tapPromise(
{
name: "MockCompressionPlugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER,
additionalAssets: true
},
async (assets) => {
for (const name of Object.keys(assets)) {
const { info } = compilation.getAsset(name);
if (info && name === "asset-manifest.json") {
compilation.deleteAsset(name);
}
}
}
);
}
);
}
},
{
apply: (compiler) => {
compiler.hooks.compilation.tap("MockTerserPlugin", (compilation) => {
compilation.hooks.processAssets.tapPromise(
(compiler) => {
compiler.hooks.compilation.tap(
"MockWebpackManifestPlugin",
(compilation) => {
compilation.hooks.processAssets.tap(
{
name: "MockTerserPlugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
additionalAssets: true
name: "MockWebpackManifestPlugin",
stage: Infinity
},
async (assets) => {
for (const name of Object.keys(assets)) {
const { info } = compilation.getAsset(name);
if (info && name === "asset-manifest.json") {
compilation.deleteAsset(name);
}
}
() => {
const manifest = {
"main.js": "/main.js",
"main.js.map": "/main.js.map"
};
compilation.emitAsset(
"asset-manifest.json",
new (require("../../../../").sources.RawSource)(
JSON.stringify(manifest, null, 2)
)
);
}
);
});
}
}
);
},
(compiler) => {
compiler.hooks.compilation.tap("MockCompressionPlugin", (compilation) => {
compilation.hooks.processAssets.tapPromise(
{
name: "MockCompressionPlugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER,
additionalAssets: true
},
async (assets) => {
for (const name of Object.keys(assets)) {
const { info } = /** @type {import("../../../../").Asset} */ (
compilation.getAsset(name)
);
if (info && name === "asset-manifest.json") {
compilation.deleteAsset(name);
}
}
}
);
});
},
(compiler) => {
compiler.hooks.compilation.tap("MockTerserPlugin", (compilation) => {
compilation.hooks.processAssets.tapPromise(
{
name: "MockTerserPlugin",
stage: Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
additionalAssets: true
},
async (assets) => {
for (const name of Object.keys(assets)) {
const { info } = /** @type {import("../../../../").Asset} */ (
compilation.getAsset(name)
);
if (info && name === "asset-manifest.json") {
compilation.deleteAsset(name);
}
}
}
);
});
}
]
};