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

前端 未结 5 828
暗喜
暗喜 2020-12-11 01:05

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 (gr

5条回答
  •  一向
    一向 (楼主)
    2020-12-11 01:43

    Interestingly, mine was because the { was put on a new line, yet i was returning an object so i changed

    from

    "use strict";
    var funcName1 = function(){
        /* some code*/
        return
        { // note this bracket
            funcName2:function(){/* some code*/},
        };
    }
    

    to

    "use strict";
    var funcName1 = function(){
        /* some code*/
        return { // to this, same line
            funcName2:function(){/* some code*/},
        };
    }
    

提交回复
热议问题