mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 20:02:40 +08:00
fix(@angular-devkit/build-angular): don't override asset info when updating assets
Currently, we are overriding asset info instead of appending additional data to it.
This commit is contained in:
parent
f2598a4d57
commit
fac9cca66b
@ -71,9 +71,10 @@ export class CssOptimizerPlugin {
|
||||
|
||||
if (cachedOutput) {
|
||||
await this.addWarnings(compilation, cachedOutput.warnings);
|
||||
compilation.updateAsset(name, cachedOutput.source, {
|
||||
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
||||
...assetInfo,
|
||||
minimized: true,
|
||||
});
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -93,7 +94,10 @@ export class CssOptimizerPlugin {
|
||||
const optimizedAsset = map
|
||||
? new SourceMapSource(code, name, map)
|
||||
: new OriginalSource(code, name);
|
||||
compilation.updateAsset(name, optimizedAsset, { minimized: true });
|
||||
compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
|
||||
...assetInfo,
|
||||
minimized: true,
|
||||
}));
|
||||
|
||||
await cacheItem?.storePromise({
|
||||
source: optimizedAsset,
|
||||
|
@ -123,9 +123,10 @@ export class JavaScriptOptimizerPlugin {
|
||||
>();
|
||||
|
||||
if (cachedOutput) {
|
||||
compilation.updateAsset(name, cachedOutput.source, {
|
||||
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
||||
...assetInfo,
|
||||
minimized: true,
|
||||
});
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -209,7 +210,10 @@ export class JavaScriptOptimizerPlugin {
|
||||
const optimizedAsset = map
|
||||
? new SourceMapSource(code, name, map)
|
||||
: new OriginalSource(code, name);
|
||||
compilation.updateAsset(name, optimizedAsset, { minimized: true });
|
||||
compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
|
||||
...assetInfo,
|
||||
minimized: true,
|
||||
}));
|
||||
|
||||
return cacheItem?.storePromise({
|
||||
source: optimizedAsset,
|
||||
|
@ -39,9 +39,14 @@ export class TransferSizePlugin {
|
||||
actions.push(
|
||||
brotliCompressAsync(scriptAsset.source.source())
|
||||
.then((result) => {
|
||||
compilation.updateAsset(assetName, (s) => s, {
|
||||
compilation.updateAsset(
|
||||
assetName,
|
||||
(s) => s,
|
||||
(assetInfo) => ({
|
||||
...assetInfo,
|
||||
estimatedTransferSize: result.length,
|
||||
});
|
||||
}),
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
compilation.warnings.push(
|
||||
|
Loading…
x
Reference in New Issue
Block a user