Vite · VITE0003

Do not URL-reference source files as public assets

Flags /src/ asset URLs in native Vue template attributes that are not transformed by default.
VITE0003vite-doctor/viteassetswarnNo fix
vite/assets/no-src-absolute-public-urlsrc/rule-packs/vite/rules/assets.ts Upstream docs

Run this rule

pnpm vite-doctor . --framework vite --rules vite/assets/no-src-absolute-public-url

Why it matters

Vite's Vue plugin imports static asset URLs on img, video, source, image, and use elements, including absolute /src/ paths. Bound string literals and other native URL attributes remain runtime URLs and can point to source files that are absent from the production output. This rule assumes the default Vue asset transforms; custom component props and custom transformAssetUrls mappings are not inferred.

Import source assets and bind the generated URL, or move unchanged assets into public and reference them from /.

Example

Import src assets

Before

<template>
  <img :src="'/src/assets/logo.svg'" alt="Logo">
</template>

After

<script setup lang="ts">
import logoUrl from './assets/logo.svg'
</script>

<template>
  <img :src="logoUrl" alt="Logo">
</template>
Copyright © 2026