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

96
Views
What is the best way to use dist and public folders in a webpack app

I am trying to do a webpack project but every tutorial I see on the internet uses the same folder for assets and distribuition, but I would like to know if there's a better way to manage assets and static files in a folder and than build everything in a Dist or Build folder later.

The structure would be:

| /src -> every coding including css and other html pages.

| /public -> index.html, favicon.ico...

        | /public/assets -> put images and other stuff here

and later:

| /dist -> combine everything in here: index.html, js files and assets.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

That should be the point of file-loader

Add this rule to webpack.config.js

{
  test: /\.(png|jpe?g|gif)$/i,
  loader: 'file-loader',
  options: {
      outputPath: 'assets',
      publicPath: 'assets',
  },
}

In webpack5, the rule can be this one, click asset-modules for more details

{
  type: 'asset/resource',
  test: /\.(png|jpe?g|gif)$/i,
  generator: {
    filename: 'assets/[hash][ext][query]'
  },
}
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!