           return "#{start}global.Lovely"
         else
           dependencies.push(module)
-          return "#{start}Lovely.modules['#{module}']"
+          return "#{start}global.Lovely.modules['#{module}']"
+
+    # adding the 'exports' object
+    if /[^a-z0-9_\-\.]exports[^a-z0-9\_\-]/i.test(source)
+      source = "var exports = {};\n\n#{source}\n\nreturn exports;"
+
+    # adding the 'global' object
+    if /[^a-z0-9_\-\.]global[^a-z0-9\_\-]/i.test(source)
+      source = "var global = this;\n"+ source
 
     # creating the Lovely(....) definition
     source = """

        if !Super then "#{start}#{Klass} = new Class"
        else "#{start}#{Klass} = new Class #{Super},"

    # building the basic scripts
    source = require('coffee-script').compile(source, {bare: true})


    """

  else
    # extracting the 'require' modules to make dependencies
    dependencies = []
    source = source.replace /([^a-z0-9_\-\.])require\(('|")([^\.].+?)\2\)/ig,
