   # Find all the require calls and push them into dependencies.
   content
     .replace(commentRegex, '') # remove comments
-    .replace(cjsRequireRegex, (match, dep) -> deps.push(dep))
+    .replace(cjsRequireRegex, (match, dep) -> deps.push(dep) if dep not in deps)
   deps
 
 module.exports = {setEnv, compileDir, watchDir, startAndWatchServer}

        repoDir = sysPath.join(userDir, repo)
        if isDirectory(repoDir)
          aliases[repo] = aliases["#{user}/#{repo}"] = "components/#{user}/#{repo}/index"

buildAliases()



          modulePath = sysPath.relative(publicDir, path)[...-3]
          deps = parseDeps(js)

          # Concat package deps
          match = modulePath.match(/^components\/(.*)\/(.*)\//)
          if match
            extraDeps = packageDeps["#{match[1]}/#{match[2]}"]
            if extraDeps?.length > 0
              deps = deps.concat(extraDeps)

          js = "define('#{modulePath}', #{JSON.stringify(deps)}, function(require, exports, module) {#{js}});"
          fs.writeFileSync path, js
          logging.info "copied #{source}"
