The following input works fine if it's transpiled as a single file down to ES5 and then recompiled.
goog.module('x');
var {a,b} = goog.require('y');
console.log(a, b);
If it's compiled directly as ES6 input, it fails with the following error:
input0:3: ERROR - The local variable a is in a goog.scope and is not an alias.
var {a,b} = goog.require('y');
^
input0:3: ERROR - The local variable b is in a goog.scope and is not an alias.
var {a,b} = goog.require('y');
^
2 error(s), 0 warning(s)
Presumably this has to do with the way goog.module is rewritten as a goog.scope (though it's not clear why it would work in single-file mode).
As I recall, we intentionally placed the ScopedAliases pass _after_ some of the early transpilation passes (specifically Es6RewriteDestructuring) so that it would not have to understand destructuring syntax. It looks like we got too aggressive at pushing the transpilation later and later, so we either need to reorder the passes or make ScopedAliases understand this syntax.
After some discussion, it seems the best approach is for goog.module to not use goog.scope at all. We have a TODO for this, in fact.
This is now in progress. No official ETA other than "soon". Apologies for the delay.
Yay @stalcup!
Most helpful comment
Yay @stalcup!