I am building a JavaScript module. Can load the first file in the module no problem. From there I want to load other files, but requirejs follows the path from the index. I want the functions in the module to be available in global scope. The structure is like this:
index.html:
<script src="scripts/app.js"></script>
app.js:
requirejs([ "../../modules/foo" ], function(util) {
});
modules/foo.js:
requirejs([ "bar" ], function(util) {
});
That gives the error: ERR_FILE_NOT_FOUND, well, yes, if you look from app.js you will not find it. How to force requirejs to load from the module?
These posts are probably related, but I can't wrap my head around it: