Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!