Closed matthewrobb closed 10 years ago
In fact, the transpiler is catching and asserting on ALL redeclarations, not just imports/exports. I know that these will be static errors in a strict body but it doesn't seem like it's appropriate for the module transpiler to keep people from shooting themselves in the foot in this way.
I'd propose that the asserting be changed to only those of imports/exports.
Currently seeing this issue with non imports too, importing d3 for example, would cause the assertImportIsNotReassigned to trigger for all the for(var i = ...
loops.
Current work around is to disable the assertion by doing:
require('es6-module-transpiler/lib/rewriter').prototype.assertImportIsNotReassigned = function() { }
@meandmycode That is resolved by #148
Fantastic, thank you for contributing and fixing this.
This is fixed as of v0.6.2 thanks to @matthewrobb's work.
Currently there are some common es6 modules (handlebars in my case) that use the following pattern:
This leads to the above error.
I am not entirely sure what the spec says about this case but it DOES seem like an easy mistake. I guess as I type this I realize that in strict bodies this is an error anyway but I am curious if the reported error should be changed because while yes the foo identifier is declared twice in the body of the module, only ONE of those declarations is technically an export declaration.