fixes #736 (closed)
Turns out there was an even simpler repro:
// mod.js
export var x = 1;
// main.js
import { x } from './mod.js';
The issue is the design of module hygiene assumes bundling of all the modules #662 and so sets up a forwarding binding for each imported name. This greatly simplifies module bundling (just emit each module and bindings take care of themselves) but since we don't have bundling yet we run into this problem.
The solution is a little hacky, only add forwarding bindings to import names when:
- not the entrypoint or
- importing for phase > 0 or
- importing a compiletime binding
Don't merge just yet, I still need to add tests.