最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ASP.NET bundle does not work when deployed (debug="false") - Stack Overflow

programmeradmin3浏览0评论

In development bundling works as expected with unbined and unminified files but after deploying a site with web.config set enable the bundles

<pilation debug="false" targetFramework="4.5" />

the result of get a request to a bundle may include a ment at the top similar to the following

/* Minification failed. Returning unminified contents.
.. errors like JS1002 or JSxxxx errors

In other cases no errors are thrown from minification but some javascripts fails to run or errors during execution.

What syntax in otherwise working javascript might cause this behavior after bundling?

In development bundling works as expected with unbined and unminified files but after deploying a site with web.config set enable the bundles

<pilation debug="false" targetFramework="4.5" />

the result of get a request to a bundle may include a ment at the top similar to the following

/* Minification failed. Returning unminified contents.
.. errors like JS1002 or JSxxxx errors

In other cases no errors are thrown from minification but some javascripts fails to run or errors during execution.

What syntax in otherwise working javascript might cause this behavior after bundling?

Share Improve this question asked Jan 8, 2013 at 21:01 Keith LawrenceKeith Lawrence 6414 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

One situation that can cause this is a single line ment // as the last line of a javascript file. This will cause the next file appened to have at least the first line also mented out

if forexample you have a bundle

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";    
}
发布评论

评论列表(0)

  1. 暂无评论