0

I just can't understand what I did Wrong

require(['jquery'],
    function($){
        function main() {
            console.log("test");
        }
    return main;
});
ert3
  • 114
  • 11
  • If you want to return a value that is going to be used somewhere else you should be using `define`, not `require`. It is impossible to return anything meaningful with `require`. The return value will be swallowed and not available anywhere else. – Louis Oct 05 '17 at 15:03
  • @Louis the function is page specific, also I get this Error: Mismatched anonymous define() module which I just can't get considering no other – ert3 Oct 05 '17 at 15:17

1 Answers1

-1

just try this one, it works fine for me by removing the parentheses that is surrounding the function

require['jquery'],
function($){
    function main() {
        console.log("test");
    }
return main;
};