I'm using asp.net mvc .Net framework 4.6.2. I have a test.js file with this content:
function ThisIsTestFunction() {
for (var i = 0; i < 100; i++) {
//will do some test
let b = i + 10;
let c = b / 2;
var str = `My name is ${a + c}`;
}
}
Checking network response for this file bundle on debug=false I get:
/* Minification failed. Returning unminified contents.
(6,19-20): run-time error JS1014: Invalid character: `
(6,23-27): run-time error JS1004: Expected ';': name
(6,39-40): run-time error JS1014: Invalid character: `
*/
function ThisIsTestFunction() {
for (var i = 0; i < 100; i++) {
//will do some test
let b = i + 10;
let c = b / 2;
var str = `My name is ${a + c}`;
}
};
If I delete the line with the template literals (
"var str =
My name is ${a + c};"
) the bundle minification works! So I understand that the minification engine doesn't like/know how to deal with that.
What are my options with minifications when the js scripts contains template literals?