-
Notifications
You must be signed in to change notification settings - Fork 138
Description
Feature Description
As noted in #876 (comment), the Image Loading Optimization module (see #869) is currently loading web-vitals.js directly from unpkg.com:
performance/modules/images/image-loading-optimization/detection/detect.js
Lines 317 to 321 in 03f3252
| // TODO: Use a local copy of web-vitals. | |
| const { onLCP } = await import( | |
| // eslint-disable-next-line import/no-unresolved | |
| 'https://unpkg.com/web-vitals@3/dist/web-vitals.js?module' | |
| ); |
This is not ideal from a performance perspective (due to the additional DNS lookup) nor from a privacy perspective (potentially). In any case, for any future consideration for merging this module into WordPress core, a local copy off the JS file will certainly be required.
A build process is also needed for the proposed Partytown module (#556 (comment)).
In short, I believe this would entail having a new command added to the npm scripts which would copy the web-vitals.js module script into the plugin, while keeping this copy .gitignore'ed. This file would nevertheless need to be included in any PerfLab plugin ZIP/deploy or when eventually when the standalone plugin is built.