I know it is recommended not to use them, but let's say just for fun I'd like to use module with custom name. How can I load it?
I have following structure:
-- ./index.html
-- ./js/app.js
-- ./js/test.js
In HTML, I'm loading RequireJS (2.1.14)
<script src="js/require.js" data-main="js/app" type="text/javascript"></script>
In app.js:
require(["dummy"], function(){
window.console.log("ready");
})
In test.js:
define("dummy", [], function(){
window.console.log("dummy loaded");
})
But RequireJS is trying to load dummy.js. What am I missing here?
Update:
I know I can use require.config to load the file
require.config({
paths: {
"dummy" : "test"
}
})
But then I don't understand why is one able to define custom name if he has to re-declare it again in paths...