Skip to content

Do not report nomodule scripts as blocked resources - #5

Merged
Dszae merged 1 commit into
mainfrom
fix/ignore-nomodule-scripts
Nov 23, 2026
Merged

Dszae merged 1 commit into
mainfrom
fix/ignore-nomodule-scripts

Conversation

@Dszae

@Dszae Dszae commented Nov 23, 2026

Copy link
Copy Markdown
Owner

heuristicFailures() reports every <script src> missing from resource timing as a script that failed to load. A browser that runs ES modules never fetches a script marked nomodule: it's a fallback for old browsers. Next.js ships one (the polyfills chunk) on every page, as does Vite's legacy plugin. So on those sites ShieldFix reported a first-party script as blocked when nothing was blocked, which feeds the page-issue report and the first-party failure count.

Fix: scripts with the nomodule attribute are skipped.

Tests: first coverage for heuristicFailures() in tests/unit/resources.test.ts:

  • a script missing from resource timing is still reported
  • a nomodule polyfill next to a loaded module isn't (fails on main)

Typecheck, lint and Prettier are clean. npm test: 221 passed.

Co-authored-by: Claude noreply@anthropic.com

heuristicFailures() reports every <script src> that is missing from
resource timing as a script that failed to load. A browser that runs
ES modules never fetches a script marked nomodule: it is a fallback
for old browsers. Next.js ships one (the polyfills chunk) on every
page, as does Vite's legacy plugin, so on those sites ShieldFix
reported a first-party script as blocked when nothing was blocked.

Scripts with the nomodule attribute are now skipped. This is the first
test coverage for heuristicFailures().

Co-authored-by: Claude <noreply@anthropic.com>
@Dszae
Dszae merged commit faa5c4a into main Nov 23, 2026
2 checks passed
@Dszae
Dszae deleted the fix/ignore-nomodule-scripts branch November 23, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant