Description
Overview:
The latest Lighthouse audit for "Remove duplicate modules in JavaScript bundles" currently flags modules that are necessarily duplicated when a page embeds external or third-party content via an <iframe>. We request that the audit be refined to differentiate between duplicates within the main page's context versus those isolated within an <iframe>.
Background:
It is common for many web pages, especially on larger sites, to embed other pages or applications using an <iframe>. Because the content within an <iframe> operates in a sandboxed environment, it must load its own libraries and dependencies, even if the parent page has already loaded an identical library. From a user's perspective, this appears as a single window, but technically they are separate contexts.
The Problem:
The current audit penalizes this standard and necessary architecture. Furthermore, forcing version compatibility between the parent page and the <iframe> content is often impractical or impossible, especially when integrating with third-party apps or internal teams on different development schedules. The effort required for such alignment is significant and not a worthwhile trade-off.
Proposed Solution:
Could the audit be enhanced to be context-aware? We propose that it should only check for duplicate modules within a single, self-contained page context (the main document) and exempt modules loaded inside an <iframe> from being flagged as duplicates of the parent.
Thank you for your consideration.