           root.udefine.globals[name] = result
         
         
-      # Inject result into defined namespace
-      if Object.hasOwnProperty.call root.udefine.inject, name
-        injectName = root.udefine.inject[name].name
-        injectRoot = root.udefine.inject[name].root
+    # Inject result into defined namespace
+    if Object.hasOwnProperty.call root.udefine.inject, name
+      injectName = root.udefine.inject[name].name
+      injectRoot = root.udefine.inject[name].root
+      
+      root.udefine.inject(injectRoot, injectName)(result)
         
-        root.udefine.inject(injectRoot, injectName)(result)
     result
   
   # Helper function to inject function/object into any object

hasModule = module? and module.exports?
exportObject = {}

isObject = (obj) -> typeof obj is 'object' and not Array.isArray(obj)

# Root object hook
do (root = if hasModule then exportObject else this) ->
  rootExport = if hasModule then {} else root
  
  resolveModule = (factory, deps) ->
    if typeof factory is 'function'
      factory.apply @, deps
    else
      factory
  
  root.udefine or= (name, deps, factory) ->
    throw new Error 'A udefine module needs to have a name' unless name?
    

            requireArr.push root.udefine.commonjs[dep]
        
        # Common JS
        result = module.exports = resolveModule factory, requireArr
      else
        # Usual browser environment
