I'm trying to load dynamic assets in nuxt. I followed all the advice saying one should use require but I can't get it to work.
With this in my template,
<v-img :src="mimeTypeUrl()"></v-img>
the following results in Error: "Cannot find module '~/assets/media/application-vnd-google-earth-kmz.png'"
methods: {
mimeTypeUrl() {
const f = '~/assets/media/application-vnd-google-earth-kmz.png';
return require(f);
}
}
but this works fine:
methods: {
mimeTypeUrl() {
return require('~/assets/media/application-vnd-google-earth-kmz.png');
}
}
What's the problem here and how can I solve this?
@nuxt/core version: 2.11.0
webpack version: 4.41.6