Even with the most up-to-date version of
Microsoft.AspNet.Web.Optimization v1.1.3
, I have encountered an issue regarding JavaScript minification when using template literals. When attempting to include code like the following in a bundle script:
var name = 'Bob';
var formattedName = `${name} says hello`;
The bundled files are merged without minifying the code, resulting in the following error message:
/* Minification failed. Returning unminified contents.
(2,13-14): run-time error JS1014: Invalid character: `
(2,15-16): run-time error JS1004: Expected ';': {
(2,30-31): run-time error JS1014: Invalid character: `
(3,1-2): run-time error JS1107: Expecting more source characters
*/
I am aware that template literals were introduced in ECMAScript2015 and may not be fully supported yet. Is there a workaround to achieve minification without reverting to traditional string concatenation methods?
var name = 'Bob';
var formattedName = name + ' says hello';
Additionally, can we expect support for template literals in future releases of
Microsoft.AspNet.Web.Optimization
?