ES Modules: suggestions for improvement

Claus Reinke claus.reinke at
Tue Jul 24 12:30:13 PDT 2012

> Being able to access the export object from the module object enables a
> pattern we use locally, which is roughly
> require("myModule").configParameter = xyz;
> .. 
> exports.errorReporter, exports.configParameter are then used heavily within
> the module -- normally, they are not even set by the user, but they there
> in case the user needs to override some behaviour.

Shouldn't that already be possible? Only the (top-level) exports
are non-modifiable, so I think this would work:

module M {
let configParameter = default;
export function setConfigParameter(value){ configParameter = value }
export ..other code using configParameter..

Looking forward to modules shims and implementations, so 
that we can verify and harmonize our interpretations of the spec.


More information about the es-discuss mailing list