Using Absolute URLs with a File Loader

I have a project with the following structure:

/src/images/image.png
/src/modules/myModule/views/template.html

And I would like to reference image.pngfrom template.htmlfrom using file-loader, but I do not want to use an ugly relative URL, which can be easily broken:

<img src="../../../images/image.png">

Instead, I would like to use an absolute url:

<img src="/images/image.png">

Are there any settings file-loaderthat allow me to do this? Now the absolute URL is completely ignored by the loader; The URL does not change and the browser reports 404 on /images/image.png. The relative URL above works fine.

+4
source share

Source: https://habr.com/ru/post/1619625/


All Articles