# Source: themes/ess-dive/loaders/optional.js

    /**
     * RequireJS plugin
     *
     * optionally require a module to load.
     */
    define([], function () {

        return {
            /**
             *
             * @param name - The name of the resource to load
             * @param parentRequire - A local "require" function to use to load other modules.
             * @param onload - A function to call with the value for name.
             */
            load: function(name, parentRequire, onload) {

                /**
                 * This will load normally if the module is found. If the module fails
                 * then {} will be returned
                 */
                parentRequire([name], onload, function (err) {
                    var failedModule = err.requireModules && err.requireModules[0];
                    console.warn("Module " + failedModule+ " not loaded");
                    requirejs.undef(failedModule);

                    // Default returned is {}, if any module fails
                    define(failedModule, [], function () {
                        return {};
                    });

                    // Call the parent methods
                    parentRequire([failedModule], onload);
                });
        }
        };

    });