A
A
Alexey Bugaev2020-05-05 08:17:29
webpack
Alexey Bugaev, 2020-05-05 08:17:29

How to set path to html and css images?

I have such settings for uploading pictures. Everything works for CSS but doesn't work for images in HTML because index.html is in the root of the project, if you remove the option publicPath: `../` then the paths for CSS will not be correct. Tell me how to set it up so that everything works? project structure in the photo below

{
        test: /\.(png|jpe?g|gif|svg)$/,
        use: [
          {
            loader: "file-loader",
            options: {
              publicPath: `../`,
              name: "[path][name].[contenthash].[ext]",
            },
          },
        ],
      },

5eb0f6b8d8aa7157951275.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question