3 ms·
Import statements must be asynchronous in the latency-controlled environments (mostly browsers). CJS is by definition synchronous and has different order semant
by yuchi 8y ago
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.
- pvorb 8y agoBut 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.