[BUGFIX beta] Fix various issues related to ES6 import correctness.

* Remove duplicate imports.
* Ensure that modules do not declare variables with names matching local imports.

These things are currently allowed by the es6-module-transpiler but not by the ES6 spec.
Merge pull request #4823 from eventualbuddha/es6-fixes

[BUGFIX beta] Fix various issues related to ES6 import correctness.