Vue-loader: transformToRequire do not recognize webpack resolve/alias

Created on 8 Nov 2017  路  1Comment  路  Source: vuejs/vue-loader

Version

13.5.0

Reproduction link

https://github.com/lkho/temp-vue-loader-1

Steps to reproduce

git clone https://github.com/lkho/temp-vue-loader-1.git
cd temp-vue-loader-1
npm install
npm run dev

then open the browser to check

What is expected?

there should be 3 images displayed

What is actually happening?

the src of the first one is not found


currently the loader only detect urls starting with '.' and '~' for rewriting. however it is common to use alias and module resolve in webpack config and it won't work.

Most helpful comment

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

This works the same way as in css-loader: In order to be able to treat normal, unprefixed paths that you find in normal HTML as relative local file paths, an escape character is needed to tell the loader "treat this as a package, not a local file" - that's what the tilde (~ ) is for

>All comments

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

This works the same way as in css-loader: In order to be able to treat normal, unprefixed paths that you find in normal HTML as relative local file paths, an escape character is needed to tell the loader "treat this as a package, not a local file" - that's what the tilde (~ ) is for

Was this page helpful?
0 / 5 - 0 ratings