Stefanos Chrs Stefanos Chrs - 4 months ago 111
AngularJS Question

Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or immediately within another function

Hello when I run this project in Developer mode (grunt server) https://github.com/kennethlynne/generator-angular-xl everything is ok but when I run it in production mode (grunt build) I get an `


Uncaught SyntaxError: In strict mode code, functions can only be
declared at top level or immediately within another function


Anyone have any idea what's going on?
Thanks,

Ps. I posted a link to the project instead of code since the JS is split in many files.

Answer

The way I solved the problem was by removing the 'use strict' that was above the jquery in the final minified script. Another way can be changing the jQuery version to one without the strict bug

EDIT: After all it was a jQuery minification error on version 1.11, and an easy fix for this is to go to your Grunt file and comment out the line

banner: "'use strict';\n"