J
J
jslby2019-07-22 15:20:12
webpack
jslby, 2019-07-22 15:20:12

Why are the required images not connected?

There is approximately the following structure:
There is a separate component with the output of comments to which the comment tree is passed:

const listReviews = [
  {
    img: require('./img/r1.jpg'),
    publish: '30 июл в 10:04',
    author: 'Кирилл Фадеев',
    message: 'Все хорошо'
  },
  {
    img: require('./img/r2.jpg'),
    publish: '30 июл в 10:04',
    author: 'Ilay Evil',
    message: 'Все отлично'
  },
];

<Reviews list={listReviews}/>

The components are in two different folders. Why is webpack trying to load images from the component's Reviews folder and not from the current component's folder?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-22
@jslby

{
  test: /\.(jpg|png|gif|ico|svg)$/,
  use: [{
    loader: 'file-loader',
    options: {
      name: 'images/[name]-[hash:base64:5].[ext]'
    }
  }]
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question