Select to view content in your preferred language

3.0 issues with custom modules

985
4
06-17-2012 03:54 PM
JohnCartwright
Deactivated User
Hello All,

I'm using both local and remote custom modules.  In 2.x, my dojoConfig was like:


  
var dojoConfig = {
   parseOnLoad: true,
   baseUrl: './',
   modulePaths: {
      'help_panel': 'http://maps.ngdc.noaa.gov/viewers/dijits/help_panel/1.1',
      'nos_hydro': './src/dijits/nos_hydro'
   }
};


Attempting to convert to 3.0, I changed to:

var dojoConfig = {
   parseOnLoad: true,
   modulePaths: {
      'help_panel': 'http://maps.ngdc.noaa.gov/viewers/dijits/help_panel/1.1'
   },
   packages: [{
      "name": "nos_hydro",
      "location": location.pathname.replace(/\/[^/]+$/, "") + "/src/dijits/nos_hydro"
   }]
};


which works for the local module but not the remote.  I also tried

var dojoConfig = {
   parseOnLoad: true,
   packages: [{
      "name": "nos_hydro",
      "location": location.pathname.replace(/\/[^/]+$/, "") + "/src/dijits/nos_hydro"
   },
   {
      "name": "help_panel",
      "location": "http://maps.ngdc.noaa.gov/viewers/dijits/help_panel/1.1"
   }]
};


but that didn't work either.  I've tried both the remote module as a Dojo 1.6 CDN build and as plain JS.

Can someone please provide me some guidance here?

Thanks!

--john
0 Kudos
4 Replies
derekswingley1
Deactivated User
Add a slash to the end of the location for help_panel?

For your help_panel package, what are the URLs you're seeing generated for your module(s) from your app?
0 Kudos
ReneRubalcava
Honored Contributor
I add that package in a test app real quick and used a dojo.require "help_panel.HelpPanel" and the js file was downloaded in my app. I don't know what it does or how to use it, but it downloaded.

The only thing different in my dojoConfig is I have async: true, but I don't know if that would make a difference in this case.
0 Kudos
JohnCartwright
Deactivated User
Add a slash to the end of the location for help_panel?

For your help_panel package, what are the URLs you're seeing generated for your module(s) from your app?


Thanks for your reply Derek.  Adding the trailing slash doesn't seem to make any difference.  If the "dojo.require("help_panel.HelpPanel" line is reached, the page doesn't draw.

The URL for the HelpPanel (http://maps.ngdc.noaa.gov/viewers/dijits/help_panel/1.1//HelpPanel.js) is resolving OK.

--john
0 Kudos
JohnCartwright
Deactivated User
I add that package in a test app real quick and used a dojo.require "help_panel.HelpPanel" and the js file was downloaded in my app. I don't know what it does or how to use it, but it downloaded.

The only thing different in my dojoConfig is I have async: true, but I don't know if that would make a difference in this case.



Thanks for your reply Rene.  Adding
async: true
to my dojoConfig causes the error:

Uncaught TypeError: Object #<Object> has no method 'require'


I'm assuming that I need a different require statement and not simply
dojo.require('help_panel.HelpPanel');
when using async.

--john
0 Kudos