how to load js widget file in dojo ? registerModulePath is working but in 1.8 packages not working - need help immediately

351 Views Asked by At

Hello need help immediately, I have web directory as

- WebContent
    index.jsp
    dojo
    testjs
        - bpl
            - mywidget.js

Context path is /TestWeb/CheckDojo

script in index.jsp:

dojo.registerModulePath("testjs","/TestWeb/CheckDojo/testjs");

is working and i can do

require([ "dojo/dom",  "testjs/bpl/mywidget", "dojo/domReady!"], ...

but in dojo 1.8 , in dojoconfig i am using

data-dojo-config="locale:                  en-us,
                  async:                   true,            
                  config-tlmSiblingOfDojo: false, 
                  packages: [{
                              name: 'testjs', 
                              location: '/TestWeb/CheckDojo/testjs'
                            }],
                  parseOnLoad: true"

then in require mywidget is searched in dojo directory which is not the correct path.

what and how should i load the package ?

1

There are 1 best solutions below

0
Ferry Kranenburg On

Look here enter link description here (module indentifiers). The documentation tells that the location is relative of the 'dojo' folder (defined in dojo.baseUrl).

You should change the code to :

data-dojo-config="locale:                  en-us,
              async:                   true,            
              config-tlmSiblingOfDojo: false, 
              packages: [{
                          name: 'testjs', 
                          location: '../TestWeb/CheckDojo/testjs'
                        }],
              parseOnLoad: true"