Mishelbi
Mishelbi

Reputation: 75

Bundler and Minifier not minifying JavaScript files in Visual Studios 2017

I am currently trying to learn ASP.NET Core 2 because I am using Visual Studios Professional 2017. I've created a small web application that has 1 CSS page and 2 JavaScript pages. I am attempting to bundle and minify the JavaScript pages using the Bundler and Minifier extension. I have configured my bundleconfig.json page as:

[ 
          { 
            "outputFileName": "wwwroot/css/site.min.css", 
            "inputFiles": [ 
              "wwwroot/css/site.css" 
            ] 
          }, 
          { 
            "outputFileName": "wwwroot/js/site.js",
            "inputFiles": [
                "wwwroot/app/js/scripts1.js",
                "wwwroot/app/js/scripts2.js"
            ], 
            "sourceMap": true, 
            "includeInProject": true 
          }, 
          { 
            "outputFileName": "wwwroot/js/site.min.js", 
            "inputFiles": [ 
              "wwwroot/js/site.js" 
            ], 
            "minify": { 
              "enabled": true, 
              "renameLocals": true 
            }, 
            "sourceMap": false 
          }   
        ] 

but when I rigtht click on the project and choose Bundler and Minifier > Update Bundles, I get a message in the status bar that says "There was an error minifying site.js. See Error List for details." When I click on the Error List, it says "(Bundler & Minifier) Stack Empty. What I take away from this is it's not liking something in my JavaScript code so it's not bundling the two files into wwwroot/js/site.js and then fails.

Here is my very simple JavaScript:

var interval;
function EmailConfirmation(email) {
    interval = setInterval(() => {
        CheckEmailConfirmationStatus(email);
    }, 5000);
} 
function CheckEmailConfirmationStatus(email) {
    $.get("/CheckEmailConfirmationStatus?email=" + email,
        function (data) {
            if (data === "OK") {
                if (interval !== null)
                    clearInterval(interval);
                window.location.href = "/GameInvitation?email=" + email;
                
            }
        });
}

Anyone know what is causing it to fail and how do I fix this?

Upvotes: 3

Views: 6290

Answers (1)

mrfleck
mrfleck

Reputation: 321

I believe that there is an issue with Bundle Minifier and the arrow function =>. I had to update to the most current version 3.2.435 to get it to work. It still does not work if you have "sourceMap": true.

Upvotes: 2

Related Questions