Reputation: 71
I've read most of the questions here on the same topic but none of them was solving my case.
So basically we are trying to bundle and minify the AngularJs files inside the .Net code. This is the code we are using to bundle our files inside the BundleConfig.cs
bundles.Add(new ScriptBundle("~/bundles/js/spa").IncludeDirectory(
"~/App", "*.js", true
));
...
...
BundleTable.EnableOptimizations = true;
And in the browser, this is the error we are seeing with lots of errors that don't make sense - missing semicolumns when they are actually there, run-time error when everything is fine, etc.
/* Minification failed. Returning unminified contents.
(1746,27-35): run-time error JS1006: Expected ')': function
(1746,42): run-time error JS1004: Expected ';'
(1751,57): run-time error JS1004: Expected ';'
....
....
I don't really know where to search for the problem? Is it the .Net bundler or the JS code? Moving the minification inside the angularjs code is not an option.
.Net framework version: 4.7.
AngularJs version: "angular": "^1.8.0"
Thank you in advance!
Upvotes: 2
Views: 561
Reputation: 71
So apparently the ASP.Net bundler does not understand ES6 syntax. This means that you will get errors if your .js files contain ES6 syntax.
There are a few possible solutions to this problem:
Upvotes: 2