Home

Issue: 1746

Webpack doesn't load images from `assets` if using template literals

[issue link]

I am trying to use something like this

<div :style="type ? {'background-image': `url('~assets/images/${type}.svg')`, 'background-position': '96% 50%'} : ''"></div>

But Nuxt doesn’t resolve this path. GET http://localhost:3333/~assets/images/amex.svg 404 (Not Found)

Then I tried simple

<img :src="`~assets/images/amex.svg`">

But this one doesn’t work too, so the issue only when using literals.

Any chance to fix this behavior?

This question is available on Nuxt.js community (#c1568)