   
   # Configuration helper function
   udefine.configure = (configFunc) ->
-    configFunc.apply udefine, [root]
+    configFunc.apply udefine, [if hasModule then module.exports else root]
   
   # Export udefine function on CommonJS environments
   if hasModule then module.exports = udefine else root.udefine = udefine
do -> Array.isArray ?= (a) -> a.push is Array.prototype.push and a.length?

# Module switch
hasModule = module? and module.exports?
exportObject = {}

# Safe way to test against an object without array being a false positive

    # Inject result into defined namespace
    if Object.hasOwnProperty.call udefine.inject.modules, name
      injectObject = udefine.inject.modules[name]
    else
      if udefine.autoInject and udefine.env.globals
        injectObject = {root, name}
      
      {root: injectRoot, name: injectName} = injectObject
      
      udefine.inject(injectRoot, injectName)(result)
        
    result
  
  # Allow auto injection of modules in a browser environment
  udefine.autoInject = true
  
  # Helper function to inject function/object into any object
  udefine.inject = (obj, name) -> (res) ->
