在开发中,捆绑按预期使用未组合和未组合的文件,但在使用web.config set部署站点后启用捆绑包
<compilation debug="false" targetFramework="4.5" />
/* Minification Failed. Returning unminified contents. .. errors like JS1002 or JSxxxx errors
在其他情况下,没有错误从缩小中抛出但是一些javascripts在执行期间无法运行或出错.
在其他工作javascript中使用什么语法可能会在捆绑后导致此行为?
解决方法
可能导致此问题的一种情况是单行注释//作为javascript文件的最后一行.这将导致所附加的下一个文件至少第一行也被注释掉了
如果你有一个捆绑
bundles.Add(New ScriptBundle("~/bundles/test").Include( "~/Scripts/adder.js","~/Scripts/printer.js"))
adder.js
function adder(a,b) { return a + b; } //this is the adder.js
printer.js
printer = true; if (printer) { alert("It works"); document.getElementById("itWorked").textContent = "It worked"; }