answered below in https://news.ycombinator.com/item?id=11491590
> and the scoping doesn't work out-of-the-box in a browser
sorry, didn't get you on this one. Example?
> Tree-shaking and static analysis are only possible with CommonJS/AMD if you strictly limit them to declarative-style use: imports at the top-level only, exports as a literal, etc. Deviate from that and tools trip up. In that case, it's better to have a new, clear, declarative-only syntax.
Agreed with the former part, but I am not sure how the new syntax is better and clear. Infact the new syntax imposes limitations. The old regular would just not optimize in some cases. You won't lose anything or any optimization.
Further, the "top-level" only is a bit of an itch. I want to be able to do this:
if (DEBUG) {
import 'something';
}
which is a common usecase and something the builder can easily remove at build time. But ES treats that as a syntax error. The "old" way doesn't have this limitation. Surely the builder's grammar can be extended to support this with the new syntax, but it just feels more magical and weird.You/someone might very well have an answer for that - honest question, not mocking :)