A
A
Alex_872021-01-23 20:13:51
webpack
Alex_87, 2021-01-23 20:13:51

How to set the correct paths for images when generating css when switching to production mode?

Hello! Webpack question! I ran into a problem with regards to the paths of images in css when translating the project to build (in my case, to dist).
The fact is that when I work in less files in development mode, I have the path to pictures (language icons) like this: '/img/' . But in dist, the path must be: '../img', otherwise the images are not visible. Please tell me how to do it? How to tweak webpack-config so paths are generated correctly? I note right away that the img folder itself is static. That is, webpack-config does not work with images in any way. They are originally located in the dist folder
PS Open with webpack and the dist itself after the build to see the difference.
Link: https://codesandbox.io/s/vibrant-http-f211v?file=/...

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