Vite · VITE0001
Keep new URL asset paths analyzable
Flags dynamic new URL in Vite assets code before it leaks into runtime behavior.
Run this rule
pnpm vite-doctor . --framework vite --rules vite/assets/no-dynamic-new-url
Why it matters
Vite configuration runs in both dev and build pipelines. Narrow, explicit settings reduce surprises across SSR, workers, and local file access.
Recommended fix
Remove dynamic new URL, or move it to the Vite runtime/API that owns that behavior.
Useful links
Example
Use static asset URLs
Before
const icon = new URL(`./icons/${name}.svg`, import.meta.url).href
After
const icons = {
home: new URL('./icons/home.svg', import.meta.url).href,
}
const icon = icons.home