ASP.NET MVC 5 捆绑和缩小 Javascript ES6
ASP.NET MVC 5 Bundling and minification Javascript ES6
当我尝试在我的应用程序中使用 Ecmascript-6 功能时,缩小失败。
如果我尝试使用箭头函数:
$.get('/clients/all').done(response => {
// Do something with the response
})
我收到以下错误:
/* Minification failed. Returning unminified contents.
(8,45-46): run-time error JS1195: Expected expression: >
(36,6-7): run-time error JS1195: Expected expression: )
(37,1-2): run-time error JS1002: Syntax error: }
*/
ES6 的其他特性等等。
你知道 ES6 的 ItemTransform 吗?
仍然没有 ES6+ 的 .NET 捆绑包。
But as a workaround you can use: babeljs.io > Try It Out > Presets: ES2015.
以下代码:
var gridNames = Enumerable.From(verifiedKeys).Select(x => `demo_${x}`).ToArray();
将翻译成:
var gridNames = Enumerable.From(verifiedKeys).Select(function (x) {
return "demo_" + x;
}).ToArray();
Link: https://babeljs.io/repl 并检查:Presets > ES2015
.
当我尝试在我的应用程序中使用 Ecmascript-6 功能时,缩小失败。
如果我尝试使用箭头函数:
$.get('/clients/all').done(response => {
// Do something with the response
})
我收到以下错误:
/* Minification failed. Returning unminified contents.
(8,45-46): run-time error JS1195: Expected expression: >
(36,6-7): run-time error JS1195: Expected expression: )
(37,1-2): run-time error JS1002: Syntax error: }
*/
ES6 的其他特性等等。
你知道 ES6 的 ItemTransform 吗?
仍然没有 ES6+ 的 .NET 捆绑包。
But as a workaround you can use: babeljs.io > Try It Out > Presets: ES2015.
以下代码:
var gridNames = Enumerable.From(verifiedKeys).Select(x => `demo_${x}`).ToArray();
将翻译成:
var gridNames = Enumerable.From(verifiedKeys).Select(function (x) {
return "demo_" + x;
}).ToArray();
Link: https://babeljs.io/repl 并检查:Presets > ES2015
.