admin管理员组

文章数量:1420907

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";    
}

本文标签: javascriptASPNET bundle does not work when deployed (debugquotfalsequot)Stack Overflow