Conversation
export {Foo as Baz}.as style module exports
| // Handle cases like `export {Foo as Bar}`. | ||
| if (babel.isExportNamedDeclaration(path.node) && !path.node.source) { | ||
| for (const specifier of path.node.specifiers) { | ||
| if (specifier.exported.name !== specifier.local.name && |
There was a problem hiding this comment.
Talked it out, the other case is handled separately
There was a problem hiding this comment.
So the way this works is:
-
If
nodeis an import from another document, go resolve in that document instead. This logic already has its own handling to make sure that in thefoo as barcase, we look forfooin that other document, instead ofbar. -
Otherwise, look for a feature with the identifier we're resolving in the local scope of
node. This is why theexport {foo}case already worked without any special handling for that syntax (we knowfooand we know the scope).foo as bardidn't work because we didn't do thebar->fooswitch in this local document case.
I took a little stab at unifying the bar -> foo logic between the import and local cases, but it didn't seem to be actually more readable without maybe a larger refactoring.
Resolves what
foois inexport {foo as bar}.