esperantojs / esperanto

DEPRECATED: An easier way to convert ES6 modules to AMD and CommonJS
http://esperantojs.org
234 stars 21 forks source link

export default class Foo extends doesn't work #157

Open martypdx opened 9 years ago

martypdx commented 9 years ago

This doesn't seem to work:

export default class Foo {

}

fwiw this is work around:

class Foo {

}

export default Foo;
eventualbuddha commented 9 years ago

@martypdx can you show us a specific failure? What's the expected output? The actual output?

martypdx commented 9 years ago

@eventualbuddha Oops, wasn't quite the right case. It's when you have extends:

import { Reference } from './Context';

export default class DynamicReference extends Reference {

    constructor ( key, reference ) {
        super( '[' + key + ']' );
        this.reference = reference;
        reference.register( {
            mark: () => this.reset()
        }, 'computed' );
    }

    getJoinKey () {
        return this.reference.get();
    }
}

// this works:
// export default DynamicReference;
>>>
bundle.concat() can only be used with bundles that have no imports/exports (imports: [viewmodel/models/Foo], exports: [])
Error: bundle.concat() can only be used with bundles that have no imports/exports (imports: [viewmodel/models/Foo], exports: [])
    at concat (/Users/marty/ractive/node_modules/esperanto/dist/esperanto.js:2487:9)
    at Object.concat (/Users/marty/ractive/node_modules/esperanto/dist/esperanto.js:2559:40)
    at /Users/marty/ractive/gobblefile.js:157:54
    at lib$es6$promise$$internal$$tryCatch (/Users/marty/ractive/node_modules/sander/node_modules/es6-promise/dist/es6-promise.js:319:16)
    at lib$es6$promise$$internal$$invokeCallback (/Users/marty/ractive/node_modules/sander/node_modules/es6-promise/dist/es6-promise.js:331:17)
    at lib$es6$promise$$internal$$publish (/Users/marty/ractive/node_modules/sander/node_modules/es6-promise/dist/es6-promise.js:302:11)
    at lib$es6$promise$asap$$flush (/Users/marty/ractive/node_modules/sander/node_modules/es6-promise/dist/es6-promise.js:113:9)
    at process._tickCallback (node.js:355:11)
<<<
Rich-Harris commented 9 years ago

@martypdx I'm having some difficulty reproducing it locally - the error message seems like it might be referring to something else. Could you create a new branch with the problem so I can dig into it? Thanks

Rich-Harris commented 9 years ago

@martypdx ignore my last, I'm an idiot - didn't realise you'd already pushed code to https://github.com/ractivejs/ractive/pull/1740. I saw the same error, fleetingly, but updating to the most recent esperanto fixed it and now I can't see the bug again. But the module order is still off, so all the Ractive tests are failing - am digging into it