I created a new Nuxt project and put files named campus.jpg
and campus.mp4
inside the assets folder.
Then in my index.vue
I just wrote:
<template>
<div>
<video autoplay muted loop poster="~assets/campus.jpg">
<source src="~assets/campus.webm" type="video/webm">
<source src="~assets/campus.mp4" type="video/mp4">
</video>
</div>
</template>
The generated code stays with the same path (i.e. http://localhost:3000/~assets/campus.jpg
), so just 404 happens. The same path with <img src="~assets/campus.jpg">
works as expected.