HN2new | past | comments | ask | show | jobs | submitlogin

Import statements must be asynchronous in the latency-controlled environments (mostly browsers). CJS is by definition synchronous and has different order semantics when treating execution of an asynchronous loader.


But it could simply be implemented using the same routine in browsers like `import`. I don't see why `require` can't be asynchronous. There's an implicit join after the last import. Maybe it would have been enough to restrict calls to `require` to the top of a file.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: