I'm using requireJS. I have two files, with main app configuraction, functions:
app/main.js
define(["jquery", "jquery_migrate"], function() {
return {
bar: function() {
console.log('test');
}
}
});
and with some events to fire up this function:
app/events.js
require(['main_app'], function(foo) {
$('body').on('click', function(e) {
foo.bar();
e.preventDefault();
});
});
and this is routing file:
app.js
requirejs.config({
"baseUrl": "js/libs",
"paths": {
"main_app": "../app/main",
// global
"app": "../app",
"jquery": "jquery/jquery",
"jquery_migrate": "jquery/jquery_migrate"
}
});
requirejs([ "app/main", "app/events" ]);
I still have Uncaught Error: Script error for: main_app and no reponse from click event. Can anybody help? Much thx.