diff --git a/lib/executor.js b/lib/executor.js index 17fc02d..ab09c71 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -248,6 +248,12 @@ function defineModels(app, instructions) { if (typeof code === 'function') { debug('Customizing model %s', name); code(model); + // If code is a default UMD module use it + } else if (code.hasOwnProperty('default')) { + if (typeof code.default === 'function') { + debug('Customizing model %s', name); + code.default(model); + } } else { debug('Skipping model file %s - `module.exports` is not a function', data.sourceFile); @@ -295,6 +301,15 @@ function runScripts(app, list, callback) { path: filepath, func: exports, }); + // If the file contains a default UMD module, load it + } else if (exports.hasOwnProperty('default')) { + if (typeof exports.default === 'function') { + debug('Exported function detected %s', filepath); + functions.push({ + path: filepath, + func: exports.default, + }); + } } } catch (err) { g.error('Failed loading boot script: %s\n%s', filepath, err.stack);