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
.