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

199
Visualizações
Migration from webpack4 -> webpack5, bundled file will have a faulty url when it gets requested?

I'm currently working on a migration from webpack4 to webpack5. I have problems with the URL to the bundled JS (in my case client.js).

wrong url to client.js file

This request should be two different ones. Here is an image from how it was with webpack4: enter image description here

This is the entry for the client:


// ...

name: 'client',
target: 'web',
devtool: 'source-map',
entry: {
  client: ['@babel/polyfill', './src/client.js'],
},

// ...

This is the output:

// ...

output: {
  path: resolvePath(BUILD_DIR, 'public/assets'),
  publicPath: '/assets/',
  pathinfo: isVerbose,
  filename: isDebug ? '[name].js' : '[name].[chunkhash:8].js',
  chunkFilename: isDebug ? '[name].chunk.js' : '[name].[chunkhash:8].chunk.js',
},

// ...

I have also set organization.splitChunks.cacheGroups as follows:

optimization: {
  splitChunks: {
    cacheGroups: {
      commons: {
        chunks: 'initial',
        test: /[\\/]node_modules[\\/]/,
        name: 'vendors',
      },
    },
  },
},

Since I was not the person who initially did this config file it's kind of hard to debug, I'm shooting wild here. And the file is fairly large, I've just pasted the bits I believe are important. If you think the issue could be because of another configuration property, feel free to share.

Anyone know why this is happening and why this happens?

Thanks in advance!

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

@AKX (Migration from webpack4 -> webpack5, bundled file will have a faulty url when it gets requested?)

You certainly guided me to the problem here. After fixing this error I accidentally created a nested array in chunk-manifest.json. The content should be:

{
  "client": [
    "/assets/vendors.chunk.js",
    "/assets/client.js"
  ]
}

Instead I screwed up while converting the Set to an array (to be able to run filter on it) so the content was instead:

{
  "client": [
    [
      "/assets/vendors.chunk.js",
      "/assets/client.js"
    ]
  ]
}

The nested array resulted in this concatenation so the URL went with a comma instead as two different sources.

about 4 years ago · Santiago Gelvez 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