1👍
✅
The expression inside v-bind is executed at runtime, webpack aliases at compile time.
Move require() from html template to data() and it should work in production.
Simple example:
<template>
<img :src="getImg" />
</template>
<script>
export default {
name: 'Example',
data() {
return {
file: 'image',
}
},
methods: {
getImg() {
return require(`@/assets/images/${this.file}.png`)
},
},
}
</script>
Source:stackexchange.com