Vite · Assets

VITE0003Do not URL-reference source files as public assets

Flags /src/ asset URLs in native Vue template attributes that are not transformed by default.

Why it happens

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.

Fix

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>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

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