Webpack: URLs prefixed with ~ are not working

Created on 20 Mar 2017  路  8Comments  路  Source: vuejs-templates/webpack

When I try to use URLs prefixed with ~ I get the following error:

 ERROR  Failed to compile with 1 errors              12:11:00 PM

This dependency was not found:

* assets/logo.png in ./~/vue-loader/lib/template-compiler.js?{"id":"data-v-7ca92acd"}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/App.vue

To install it, you can run: npm install --save assets/logo.png

I'm using same line of code as the documentation:

<img src="~assets/logo.png">

http://vuejs-templates.github.io/webpack/static.html

Most helpful comment

With @ doesn't give an error but I get a 404

<img src="@assets/logo.png">

image

All 8 comments

Docs must be out of date. Try the @ instead of tilda.

With @ doesn't give an error but I get a 404

<img src="@assets/logo.png">

image

Edit : redacted

tildes are not necessary for urls in templates. They are a special syntax used by css-loader.

same here. When using @ or remove tild got 404

The alias works like @/assets. And in CSS, it would be ~@/assets

Please ask further questions on forum.vuejs.org

Furthermore, tildes are only useful in CSS.

Was this page helpful?
0 / 5 - 0 ratings