This gives some much needed love to the CommonJS module output.
Most importantly it mutates the module.exports object before the
code is executed which allows some cyclic dependencies to work
(function declarations).
This also changes the transformer to work on the original code
instead of the already transformed code (from ModuleTransformer).
Things have been refactored so that more code is shared between
CommonJsModuleTransformer and ModuleTransformer.
Also, the require variable binding (with __esModule) has changed
so that we do not need temp variables (outside what is needed for
destructuring).
This gives some much needed love to the CommonJS module output.
Most importantly it mutates the
module.exports
object before the code is executed which allows some cyclic dependencies to work (function declarations).This also changes the transformer to work on the original code instead of the already transformed code (from
ModuleTransformer
).Things have been refactored so that more code is shared between
CommonJsModuleTransformer
andModuleTransformer
.Also, the require variable binding (with
__esModule
) has changed so that we do not need temp variables (outside what is needed for destructuring).