3 ms·
Modules load and eval asynchronously, because there's no viable way for network connected device like a browser to do it synchronously. But modules still run i
by spankalee 6y ago
Modules load and eval asynchronously, because there's no viable way for network connected device like a browser to do it synchronously.
But modules still run in depth-first import order, so there is a perfectly fine way do work before other modules run by putting that init code in a separate module and importing it first.
Your second point applies the same to imports and require.