For reference, I'm trying this in Meteor, in which case the first module to be evaluated is module B, but that means that `C` is `undefined` during evaluation of `B`, so we get an error.
*/#!/*JoePea On Tue, Aug 9, 2016 at 1:05 PM, /#!/JoePea <[email protected]> wrote: > Oops, I forgot the export in module C: > > ```js > // --- Module C > > import A from './A' > import B from './B' > > console.log('Module C', A, B) > > class C { > constructor() { > // this may run later, after all three modules are evaluated, or > // possibly never. > console.log(A) > console.log(B) > } > } > > export {C as default} // export! > ``` > > */#!/*JoePea > > On Tue, Aug 9, 2016 at 1:03 PM, /#!/JoePea <[email protected]> wrote: > >> I have the very basic problem detailed at http://stackoverflow.com/qu >> estions/38841469, but thought I'd bring it up here because it makes me >> wonder about the ES6 Module system. >> >> Why is it that the body of module C is not evaluated before the bodies of >> modules A and B? I'm just wondering, because if that were the case, then it >> would work and the entrypoint would eventually be evaluated without errors. >> >> A possibility could be that maybe it *should* work, and that my ES6 >> module environment simply doesn't handle it as it should? (But I'm not >> familiar enough with the spec, so that's why I'm not sure about that.) >> >> These are the modules, posted here for convenience: >> >> ```js >> // --- Entrypoint >> >> import A from './app/A' >> console.log('Entrypoint', A) >> ``` >> >> ```js >> // --- Module A >> >> import C from './C' >> >> console.log('Module A', C) >> >> class A extends C { >> // ... >> } >> >> export {A as default} >> ``` >> >> ```js >> // --- Module B >> >> import C from './C' >> >> console.log('Module B', C) >> >> class B extends C { >> // ... >> } >> >> export {B as default} >> ``` >> >> ```js >> // --- Module C >> >> import A from './A' >> import B from './B' >> >> console.log('Module C', A, B) >> >> class C { >> constructor() { >> // this may run later, after all three modules are evaluated, or >> // possibly never. >> console.log(A) >> console.log(B) >> } >> } >> ``` >> >> */#!/*JoePea >> > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

