Skip to content
svelte-vitals
English
Esc
navigateopen⌘Jpreview
On this page

performance/preload-missing-as · Preload missing as

Every <link rel="preload"> should declare an as attribute.

Severity: warning

What it checks

Every <link rel="preload"> must have an as attribute naming the resource type (style, script, font, image, …). A preload without as is flagged.

Why it matters

A <link rel="preload"> without an as attribute is ignored by the browser (or fetched a second time), wasting the preload.

How to fix

Add an as attribute matching the resource type:

<link rel="preload" href="/app.css" as="style" />

Mode differences

Source analysis (the CLI, the dashboard’s static baseline) composes each route’s <head> from <svelte:head> in the page and its layout chain, followed into repo-local components, plus the known meta components (svelte-meta-tags, svelte-seo) and any you declare in metaComponents. It judges only a literal value; it never examines a dynamic one. Rendered analysis (the Vite plugin’s build pass, a route you visit in the dashboard) reads the shipped <head>, where every value is literal; the build pass covers prerendered routes only. When the two disagree, trust the rendered result.

Disabling

Record existing findings in the suppressions file (npx svelte-vitals --update-suppressions), scope the rule per route or path with overrides, or turn it off:

export default {
  rules: {
    'performance/preload-missing-as': 'off'
  }
};