Encountered an issue where the URL generated dynamically from props for image import in my Vue 3 component became undefined post-build
- Check out the script used to generate the URL and the tag in the Vue Component below
const imagePath = computed(() => { return new URL(`../assets/${props.imgPath}.png`,
import.meta.url).href
<img :src="imagePath" />
- Observed Undefined URL after build
<img class="img" src="http://localhost:4173/undefined />
Only a couple of images turn out undefined after the build, making it challenging to identify the root cause of the problem
Tried adjusting vite.config.ts, specifically assetInlineLimit under the build section, but haven't had any success yet