Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

94
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda