1

Good Day,

I am using default ASP.NET 4.5.1 bundling. All scripts are minified as expected apart of the following code:

var events = [
    function Create() {
    },
    function Delete() {
    }
];

it was minified to

var t = [function(){},function(){}];

Why does ASP.NET optimization remove function names in above scenario and how can I avoid it?

Tat
  • 11
  • 2

1 Answers1

0

Part of it is because you have an array of functions and they are accessed via an index like so:

events[0]();
events[1]();

The name of each function in the array is irrelevant so the minifier probably realizes this and removes those names.

As for why it changed the variable name "events" to "t", variable names are shortened to 1 character according this MSDN page.

Soenhay
  • 3,958
  • 5
  • 34
  • 60