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

153
Visualizações
WebCompiler extension for Visual Studio adding undesired code to minified JS scripts

I have a .NET MVC application, for which I use the (2022 version of the) WebCompiler extension for Visual Studio 2022, in order to minify my CSS et JS files.

When the JS scripts get minified, it seems like the extension is adding some undesired pieces of code to the resulting script. Things like :

function _toConsumableArray(n){if(Array.isArray(n)){for(...

Or even :

return regeneratorRuntime.async(function(o){for...

I'm assuming it does this because, for some random reason, it seems to beleive I'm using some kind of JS technology other than simple classic web JavaScript, like Node JS, Babel or whatever.

And this is causing issues on the client side obsiously, with errors like regeneratorRuntime not being defined.

Is there a way to prevent the extension from doing that ? Are there reserved keywords that can be used with other JS technologies that would make the extension beleive it's using that technology and that I should avoid using in my scripts ? Is there any other viable JS minifying extension that works with VS 2022 ? It seems like WebCompiler is discontinued.

I searched the compilerconfig.json.defaults file, but it doesn't seem to contain any option regarding this, nor does compilerconfig.json.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So I found out what was causing the regeneratorRuntime thing to appear, it was the use of the async/await keywords.

I removed the async from my function declaration, and used then() instead of await, and the regeneratorRuntime went away.

The _toConsumableArray thing is still there, probably caused by something else, but this one isn't causing any client side error, so I can live with it.

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