Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
Webpack file-loader not working for images. Creating curropted file and img src is pointed to that file

I am using webpack file-loader to load images into an HTML page. It is generating a corrupted file and using src as that file, in img tag.

this is my setting in webpack.config.js

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

final image tag which is generated

<img src="8c7b2da10ea507a829fd.jpg" alt="">
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

file-loader is deprecated for webpack version 5 so switching to Asset Modules worked, here's the documentation.

Asset Modules

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!