5

I have js files which I am using arrow function like the following:

$(document).ready(() => {});

And I am using System.Web.Optimization for bundling and minification in an MVC web application.

When I run my application it shows me the following error:

(9,20-21): run-time error js1195: expected expression: )

So, my question is there any way to configure my app to solve this issue?

7
  • .ready(() => {}); is ambiguous JavaScript (is the callback returning an empty object-literal or is it a no-op braced function?). If this is not the cause of the error then please post your *actual JavaScript. Commented Sep 29, 2020 at 11:00
  • But arrow function is a new feature in ES6 and it's not related to JQuery Commented Sep 29, 2020 at 11:04
  • 1
    Correct, it isn't related to jQuery - but I suspect that System.Web.Optimization only supports older ES3 (and maybe ES5?) language features considering that System.Web.Optimization was released in 2013 and hasn't been updated since 2014. I'd be wary of using any library or dependency for JavaScript that's more than a couple of years old. You should consider using webpack or Rollup instead. But anyway, jQuery is obsolete - it's been obsolete since IE11 came out in October 2013, imo. Commented Sep 29, 2020 at 11:06
  • Microsoft is still using System.Web.Optimization for bundling and minifying when generating MVC templates using Visual Studio :) Commented Sep 29, 2020 at 11:11
  • 2
    Only if you use the equally obsolete ASP.NET WebForms and ASP.NET MVC project templates. If you use the current ASP.NET Core project templates then you won't see references to System.Web.Optimization. Commented Sep 29, 2020 at 11:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.