W
W
wipe00092021-06-21 17:34:49
Vue.js
wipe0009, 2021-06-21 17:34:49

How to get the src of an image in webpack?

Hello, please tell me why it is not possible to make src images, that is, the code

<img
      :src="require('./assets/svg/gas-station/refueling-nozlle.svg')"
      alt="Refueling Nozle"
    />

Gives an error message
This relative module was not found:

* ./assets/svg/gas-station/refueling-nozlle.svg in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/views/GasStation.vue?vue&type=template&id=b6cbff56&scoped=true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-06-22
@wipe0009

The answer is in the error text. At the time of compilation, there is no file at:

[папка где лежит компонент]/assets/svg/gas-station/refueling-nozlle.svg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question