简体   繁体   English

ASP.NET MVC 4 JS Minification Error

[英]ASP.NET MVC 4 JS Minification Error

I'm using google-code-prettify in an ASP.NET MVC 4 project. 我在ASP.NET MVC 4项目中使用google-code-prettify It works in debug mode but in release the minification/bundling step fails. 它在调试模式下工作,但在发布时,缩小/捆绑步骤失败。

I get this error: 我收到此错误:

"Minification failed. Returning unminified contents. (104,399-436): run-time error JS5017: Syntax error in regular expression: /^(?:\\r\\n|[\\S\\s])[^\\n\\r# =A-[^`h{~] /" “缩小失败。返回未分析的内容。(104,399-436):运行时错误JS5017:正则表达式中的语法错误:/ ^(?:\\ r \\ n | [\\ S \\ s])[^ \\ n \\ r# = A - [^`h {〜] /“

The file it's complaining about is: lang-wiki.js 它抱怨的文件是: lang-wiki.js

This is the latest version from google and it runs in debug so I can only assume the bundling is incorrectly parsing the regular expression. 这是谷歌的最新版本,它在调试中运行,因此我只能假设捆绑错误地解析正则表达式。

Other than omitting this file what else can I do? 除了省略这个文件,我还能做什么? Ideally I would like to disable any error checking the bundling step attempts. 理想情况下,我想禁用任何错误检查捆绑步骤尝试。

I'm using these versions: 我正在使用这些版本:

  • Microsoft.AspNet.Mvc.4.0.20710.0 Microsoft.AspNet.Mvc.4.0.20710.0
  • Microsoft.AspNet.Web.Optimization.1.1.3 Microsoft.AspNet.Web.Optimization.1.1.3

I tried minifying these files with YUI Compressor and it works so that seems to support the incorrect parsing theory. 我尝试使用YUI Compressor缩小这些文件,它的工作原理似乎支持不正确的解析理论。

Some of minification tools such as google closure or YUI have different behavior on considering semi-colons and this cause some problems when a script is not well-formatted, while if you use grease or ajax-minifer which are tools from Microsoft , you won't see these type of problems. 一些缩小工具,如google closure或YUI在考虑分号时有不同的行为,当脚本格式不正确时会导致一些问题,而如果你使用的是油脂ajax-minifer ,它们是微软的工具,你就赢了看到这些类型的问题。

Ajax-Minifer also has build scripts that may help you out performing some actions during build process as required. Ajax-Minifer还具有构建脚本,可以帮助您在构建过程中根据需要执行某些操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM