Skip to content

Instantly share code, notes, and snippets.

@stdavis
Last active December 16, 2015 01:39
Show Gist options
  • Save stdavis/5356872 to your computer and use it in GitHub Desktop.
Save stdavis/5356872 to your computer and use it in GitHub Desktop.
Custom Dojo Loader Plugin for loading ESRI modules that you want the build system to ignore.
define(function () {
// summary:
// A dojo loader plugin for loading esri modules so that
// they get ignored by the build system.
return {
load: function (id, require, callback) {
// id: String
// esri module id
// require: Function
// AMD require; usually a context-sensitive require bound to the module making the plugin request
// callback: Function
// Callback function which will be called, when the loading finished.
require([id], function (mod) {
callback(mod);
});
}
};
});
@brianarn
Copy link

I thought the usage was more like

define(['app/EsriLoader!esri/map'], function(Map) { /* ... */ });

Since it's using require to load the module, it seems like it'd need to be a slash, not a period.

@stdavis
Copy link
Author

stdavis commented Apr 10, 2013

You're right @brianarn. I need to get out of the "." habit from the old dojo.require days.

@stdavis
Copy link
Author

stdavis commented Apr 10, 2013

Yes, @steveoh, it's working. I've successfully tested the build. The build system does not flatten nested requires. @brianarn was the one that enlightened me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment