         fs = derby.util.serverRequire module, 'fs'
 
         app.on 'bundle', (bundler) ->
-            bundler.require _.flatMapDeep app.modules, (moduleInfo, moduleName) -> [
+            modules = Object.values(app.modules).map (moduleInfo, moduleName) ->
+                [].concat [],
                     if moduleInfo.index then moduleName else []
                     if moduleInfo.opts then moduleName + '/opts' else []
-                    _.map moduleInfo.components, (p) -> if moduleName then moduleName + '/components/' + p else 'components/' + p
-                    _.map moduleInfo.pages, (p) -> if moduleName then moduleName + '/pages/' + p else 'pages/' + p
-                    _.map moduleInfo.model, (p) -> if moduleName then moduleName + '/model/' + p else 'model/' + p
-                ]
+                    moduleInfo.components.map (p) -> if moduleName then moduleName + '/components/' + p else 'components/' + p
+                    moduleInfo.pages.map (p) -> if moduleName then moduleName + '/pages/' + p else 'pages/' + p
+                    moduleInfo.model.map (p) -> if moduleName then moduleName + '/model/' + p else 'model/' + p
+            bundler.require [].concat modules...
+
             bundler.require app.components or []
 
             bundler.exclude 'app-modules'

                ctrl = require 'pages/' + name
                ctrl::name = 'pages:' + name
            ctrl::view = ctrlPath
            if _.isString ctrl::path
                ctrl::path = moduleInfo.url + ctrl::path  or  '/'
            else
                ctrl::path =

        app.modules = {}
        globalPaths = module.constructor.globalPaths
        for moduleInfo in options.modules
            if typeof moduleInfo == 'string'
                moduleInfo = name: moduleInfo
            defaults =
                path:
                    if moduleInfo.name
                        resolve.sync moduleInfo.name,
