我正在使用 Asp.Net MVC 5 和 System.Web.Optimization 1.1.0.0 中的捆绑和缩小系统:
bundles.Add(new ScriptBundle("~/angularLibraries").Include(
......
));
然后渲染 Bundle:
@Scripts.Render("~/angularLibraries")
我不时通过在浏览器中打开相应的 url 来手动检查我的包的状态,有时我会发现它们有错误。例子:
/* Minification failed. Returning unminified contents.
(262,145-152): run-time error JS1019: Can't have 'break' outside of loop: break a
(40,297-304): run-time error JS1019: Can't have 'break' outside of loop: break a
*/
因为当缩小失败时捆绑机制会返回未缩小的内容,所以直到我在浏览器中手动打开该捆绑包时,我才知道错误。
如何设置捆绑系统以在缩小失败时引发异常,以便我可以立即意识到错误?