Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

97
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda