0

I am using the requirejs domReady plugin within my code like this:

1.Config for module:

   requirejs.config({
baseUrl:'scripts',
paths:{
    async:'lib/plugins/async',
    domReady:'lib/plugins/domReady'
   }
});

2.Actual module

   require(['domReady!','./gmaps','./gmaps_controls'],function(gmaps,controls){
    //get mapdiv here by id 
        //create controls from controls module here...
   });

I get the error:

GET http://localhost:8180/lib/plugins/domReady.js 404 (Not Found) require.js:34
Uncaught Error: Script error for: domReady
http://requirejs.org/docs/errors.html#scripterror require.js:8

This is my file strcuture within the scripts folder:

 ./lib:
 plugins  require.js

./lib/plugins:
async.js  domReady.js

UPDATE2:

I load requirejs like this:

 <script type="text/javascript" data-main="scripts/gmaps_displayScenario" src="scripts/lib/require.js"></script>

This is working for me:

  requirejs.config({
baseUrl:'scripts',
paths:{
    async:'lib/plugins/async',
    domReady:'lib/plugins/domReady'
}
});

require(['domReady!','./gmaps','./gmaps_geoJSON'],function(domReady,gmaps,geoJSON){
     //code goes on

I did this because I use jQuery only for the $(document).ready() function and for making ajaxcalls...I did not want to load the whole library for this. However this is not working as specified here.

Community
  • 1
  • 1
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
  • Two questions: 1. How do you load RequireJS? 2. How do you get to that `require` statement you show in your question? Please edit your question to add the information. You do not need to break it down in two parts. For instance, if it all happens to be done by a few ` – Louis Apr 24 '14 at 10:23
  • Are your calls to `requirejs.config` and `require(['domReady!', './gmaps', ...` in the same file, and is this file the one loaded by `data-main="scripts/gmaps_displayScenario"`? – Louis Apr 24 '14 at 23:45
  • @Louis yes they are in the same file and I happen to be defining them once per module with `require` and these modules go into the `data-main`. – vamsiampolu Apr 25 '14 at 10:04

0 Answers0