Skip to content

Commit 7e8ec60

Browse files
b1ink0westonruter
andcommitted
Warn URL Metric compression is disabled due to use of deprecated finalize function
Co-authored-by: Weston Ruter <[email protected]>
1 parent aeda409 commit 7e8ec60

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

plugins/optimization-detective/detect.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,9 @@ export default async function detect( {
709709
/** @type {string[]} */
710710
const initializingExtensionModuleUrls = [];
711711

712+
/** @type {boolean} */
713+
let extensionHasFinalize = false;
714+
712715
for ( const extensionModuleUrl of extensionModuleUrls ) {
713716
try {
714717
/** @type {Extension} */
@@ -744,7 +747,7 @@ export default async function detect( {
744747
}
745748

746749
if ( extension.finalize instanceof Function ) {
747-
compressionEnabled = false;
750+
extensionHasFinalize = true;
748751
}
749752
} catch ( err ) {
750753
error(
@@ -754,6 +757,13 @@ export default async function detect( {
754757
}
755758
}
756759

760+
if ( extensionHasFinalize ) {
761+
compressionEnabled = false;
762+
warn(
763+
'URL Metric compression is disabled because one or more extensions use the deprecated finalize function.'
764+
);
765+
}
766+
757767
// Wait for all extensions to finish initializing.
758768
const settledInitializePromises = await Promise.allSettled(
759769
extensionInitializePromises

0 commit comments

Comments
 (0)