Static GitHub Issues

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

prev: TypeError when using Bookshelf.js
next: Application does not load in SPA mode?

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?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1568">#c1568</a>)</em></sub></div>