                 throw new Error("internal compiler error, only form \"import blah from 'blah'\" supported") if specifiers.length isnt 1
                 specifiers[0].id
 
-        generate_export_return = (exported, batch_exported) ->
-                exported_getters = []
-                for exp in exported
-                        exported_getters.push {
-                                type: Property,
-                                key: exp.name or exp.id,
-                                value: {
-                                        type: FunctionExpression,
-                                        params: [],
-                                        body:
-                                                type: BlockStatement
-                                                body: [
-                                                        { type: ReturnStatement, argument: exp.id }
-                                                ]
-                                },
-                                kind: "get"
+        define_export_property = (exported_id, local_id = exported_id) ->
+                console.log "exporting #{local_id.name} as #{exported_id.name}"
+                exports_id = create_identifier("exports") # XXX as with compiler.coffee, this 'exports' should be '%exports' if the module has ES6 module declarations
+
+                Object_defineProperty = {
+                        type: MemberExpression,
+                        computed: false,
+                        object: create_identifier("Object"),
+                        property: create_identifier("defineProperty")
+                }
+
+                getter = {
+                        type: FunctionExpression,
+                        params: [],
+                        defaults: [],
+                        body:
+                                type: BlockStatement
+                                body: [
+                                        { type: ReturnStatement, argument: local_id }
+                                ]
+                }
+                        
+                property_literal = {
+                        type: ObjectExpression,
+                        properties: [
+                                { type: Property, kind: "init", key: create_identifier("get"), value: getter }
+                        ]
+                }
+
+                return {
+                        type: ExpressionStatement,
+                        expression: {
+                                type: CallExpression
+                                callee: Object_defineProperty,
+                                arguments: [
+                                        exports_id,
+                                        create_string_literal(exported_id.name),
+                                        property_literal
+                                ]
                         }
-
-                obj_literal = { type: ObjectExpression, properties: exported_getters }
-
-                if batch_exported.length is 0
-                        return [ { type: ReturnStatement, argument: obj_literal } ]
-
-                # batch_exported.length > 0, so we need to insert
-                # loops over the import tmp id, adding the identifiers
-                # to our new export object
-
-                export_id = freshId("export")
-                
-                ret = [{
-                        type: VariableDeclaration,
-                        declarations: [{
-                                type: VariableDeclarator,
-                                id:   export_id,
-                                init: obj_literal
-                        }],
-                        kind: "let"
-                }]
-
-                for batch in batch_exported
-                        spec_arg = { type: ArrayExpression, elements: batch.specifiers }
-                        ret.push { type: ExpressionStatement, expression: create_intrinsic(moduleImportBatch_id, [batch.source, spec_arg, export_id]) }
-
-                ret.push { type: ReturnStatement, argument: export_id }
-                ret                
-        
+                }
+                
+                
         visitFunction: (n) ->
                 return n if not n.toplevel
                 
                 @exports = []
                 @batch_exports = []
-                n = super
-                n.body.body.push exret for exret in generate_export_return(@exports, @batch_exports)
-                n
+
+                super
                 
         visitImportDeclaration: (n) ->
                 if n.specifiers.length is 0
                         # no specifiers, it's of the form:  import from "foo"
                         # don't waste a decl for this type
-                        return create_intrinsic(moduleGet_id, [n.source])
+                        return create_intrinsic(moduleGet_id, [n.source_path])
 
                 # otherwise create a fresh declaration for the module object
                 # 

                                        }

                                        @exports.push { name: spec.name, id: spectmp }
                        console.log escodegen.generate export_decl
                        return export_decl

                # export function foo () { ... }
                if n.declaration.type is FunctionDeclaration
                        @exports.push { id: n.declaration.id }
                        return n.declaration

                # export let foo = bar;
                if n.declaration.type is VariableDeclaration
                        @exports.push({ id: decl.id }) for decl in n.declaration.declarations
                        return n.declaration

                # export foo = bar;
                if n.declaration.type is VariableDeclarator
                        @exports.push { id: n.declaration.id }
                        return n.declaration

                # export default = ...;
                # 
                if n.default
                        default_id = create_identifier "default"
                        @exports.push { id: default_id }
                        return {
                                type: VariableDeclaration,
                                declarations: [{
                                        type: VariableDeclarator,
                                        id:   default_id
                                        init: n.declaration
                                }],
                                kind: "var"
                        }

                throw new Error("Unsupported type of export declaration #{n.declaration.type}")

        visitModuleDeclaration: (n) ->
                init = 
                        type:     MemberExpression
                        object:   create_intrinsic(moduleGet_id, [n.source])
                        property: create_identifier "default"
                        computed: false

                return {
                        type: VariableDeclaration,
                        declarations: [{

                                declarations: [{
                                        type: VariableDeclarator,
                                        id:   import_tmp
                                        init: create_intrinsic(moduleGet_id, [n.source_path])
                                }],
                                kind: "let"
                        }

                        export_stuff = []                             
                        if n.default
                                # export * from "foo"
                                throw new SyntaxError("invalid export") if n.specifiers.length isnt 1 or n.specifiers[0].type isnt ExportBatchSpecifier
