     if doDeclare
       replaceOrAddToMap compiledModules, moduleName,
         declared: (subtractContexts ctx, (injectedContext requiresFor moduleName))
-        # TODO: this hack relies on JS overwriting values
-        js: ((lookupInMap compiledModules, moduleName)?.js or '') + js
+        ast: originalAst
     ast: originalAst
     errors: errors
     malformed: ctx.isMalformed

    conflict.error = yes

lookupJs = (moduleName) ->
  js = (lookupCompiledModule moduleName)?.js
  if not js
    console.error "#{moduleName} not found"
  else
    js

allInjected = (required, injected) ->



compileModuleTopLevel = (source, moduleName = '@unnamed', requiredMap = newMap()) ->
  compileModuleTopLevelAst (astFromSource "(#{source})", -1, -1), moduleName, requiredMap

compileModuleTopLevelAst = (ast, moduleName = '@unnamed', requiredMap = newMap()) ->
  addToMap requiredMap, 'Prelude', yes # TODO: Hardcoded prelude dependency
  removeFromMap requiredMap, moduleName
  for requiredModuleName of values requiredMap
