Hacker News new | ask | show | jobs
by kabes 1857 days ago
The author correctly states that you need imports to be statically analyzable for this to work. However, he then wrongfully states that this is achieved because ES6 imports can only be at the top level instead of conditionally nested. This is wrong.

What makes ES6 imports static analyzable is the fact that you are forced to name exported/imported symbols individually (instead of exporting objects as with commonjs) and the fact that module identifiers have to be string literals. You can keep these 2 properties even when you'd nest imports.

In fact, there's an ES proposal form the author of reify to support this in ES, which explains this further: https://github.com/benjamn/reify/blob/master/PROPOSAL.md