requireJS element is not a function

32 Views Asked by At

simple example RequireJs I get Error : Uncaught TypeError: hi is not a function

say.js

define(function () { 
    var say={};
    say.hi=function hi(){
    console.log('hi');
    }
    return say;
});

index.html

<script src="/js/require.js"  data-main="/js/config.js"  ></script>
<script>
    var hi; 
    require(['say'], function(say){
        hi=function() { say.hi();}
    }); 
    hi();
</script>

config.js

require.config({
    baseUrl: '/js',
    paths: {jquery: 'jquery'},   
});
0

There are 0 best solutions below