Vue-cli: Asset URL Handling: @ alias not working when not in css module mode.

Created on 9 Jul 2018  ·  6Comments  ·  Source: vuejs/vue-cli

Version

3.0.0-rc.3

Reproduction link

https://github.com/andreynazarov3/asset-url-bug

Steps to reproduce

Create a basic project with Vue CLI. Add background: url(@/assets/logo.png); to App.vue to styles.

What is expected?

Explected to resolve relative path to image with webpack.

What is actually happening?

Error: Module not found: Error: Can't resolve './@/assets/logo.png' in 'C:UsersmeDesktopasset-url-bugsrc'


Strange that it is working when use module mode.

Most helpful comment

background: url(~@/assets/logo.png)

All 6 comments

background: url(~@/assets/logo.png)

Thanks!

How to load global less file instead of importing it in every single component?

@LinusBorg I really need your help!

Then you should follow the issue guidelines and ask for help on forum.vuejs.org, not on a closed issue that was about something else.

Oh sorry, my bad

Was this page helpful?
0 / 5 - 0 ratings