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

249
Visualizações
How do I use .NET bundler with Webpack's code splitting chunks?

I have a .NET project where I'm trying to use Webpack's code-splitting functionality.

My Webpack output (the relevant part) looks like this:

{
    output: {
        path: resolve(__dirname, config.path.public),
        pathinfo: false,
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].js',
        publicPath: '/'
    },
}

My bundle config looks something like this:

private void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/js").Include(
        "~/assets/store/js/vendor.js",
        "~/assets/store/js/index.js",
        "~/assets/marketing/js/index-prod.js"));
}

When I build the front-end, Webpack generates several JS chunks: index.js, index-prod.js, 2.js, 3.js, 4.js, etc. So, the code-splitting seems to be working. However, when I fire up my browser, the pages are mostly blank, and I see an error stating that it couldn't find the source for 4.js. So it seems that the app can't find the correct path. Note that everything was working before I tried to implement code-splitting. I thought that simply specifying index.js/index-prod.js in the bundle would be sufficient, and that it would dynamically/lazy-load components (i.e. the chunks) on user interaction.

What am I doing wrong? I don't want the bundler to concatenate all the chunks (which would defeat the purpose of chunking them). And ideally, I shouldn't have to manually add each chunk file to the bundle.

about 4 years ago · Juan Pablo Isaza
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