Reputation: 491
I had a issue in my recent deployment to prod. It is a .net project.
The issue is I have a line of code in one of my js file:
for(const work in worklist)
{
....
}
After the deployment, this js file got minified and the code was changed to
for(n in n)
{
}
I solved the issue by change the const to var. But it did take some time to figure this out and this is really a trouble that you only found this error after the prod deployment.
So I am wondering is there a way to test this in dev environment? Is this a bug in the minify process or should I never use const? Is there a way to prevent this?
Thank you.
Ok, I had a another issue that I cannot solve like above. In another js file, a function:
$scope.a = function(ev){
.....in the code here I am passing ev to another pop up window.
}
got minified as:
t.a=function(t){
......now the ev passed to the pop up window is referring to $scope...
}
There is no way for me to rename $scope. If I rename ev to other variable name, it always got minified as t... Does anyone know how to solve this issue? This is so wired, I have never had this kind of minifed issue before.
The project is a .net mvc project, front end using angularJs. I think the project uses the default .net mvc minification.
Finally, I figure out a way to solve the issue. But I don't think this is a good solution. In that function, I have defined a inline controller. After I moved that controller out. The minification issue was solved. Any better solution is welcomed. Is there a way to test the minification js files in dev environment?
Upvotes: 3
Views: 1135