I’m learning how to use require.js. I am trying to define modules like this:
define('presenter', ['jquery'].......
The problem is that my host page is on a different domain at ‘http://localhost:62607/’ so I get a 404 error looking for presenter there.
Presenter is actually located here: ‘http://localhost:62588/scripts/app/presenter’.
So if I define presenter like:
define('http://localhost:62588/scripts/app/presenter', ['jquery'],
Everything works fine but I much prefer the more readable first version.
Is there anything that can be done to achieve this?
Thanks
You can use the
baseUrlandpathproperties in the requireJS configuration for achieving this.From the requireJS documentation:
If you define a module called
app, requireJS will look for it at../app