I am using some images which is in the assets directory. Webpack is not outputting the images into the public directory(generated by webpack). Please look at my code at https://github.com/akashshyamdev/lorem and help me out.
Asked
Active
Viewed 1,005 times
1 Answers
0
You need to add a webpack loader called file-loader: https://webpack.js.org/loaders/file-loader/

mgm793
- 1,968
- 15
- 23
-
Thanks for the suggestion but if you look in the source code, you will see that i have file-loader – Akash Shyam Oct 25 '20 at 10:17
-
But I can not see any webpack.config.js file – mgm793 Oct 25 '20 at 10:49
-
There is no webpack.config.js instead webpack.dev.js and webpack.prod.js Please check again. Thank you – Akash Shyam Oct 25 '20 at 11:09
-
The point is that you import images on HTML not on JS, and that's why file-loader is not acting. If you want to use it on html only, you can use CopyWebpackPlugin and copy assets folder. https://stackoverflow.com/a/33374807/5689074 – mgm793 Oct 25 '20 at 12:54