ES modules: A cartoon deep-dive (2018)

be careful with side effects in your code. It can also lead to bugs and make your code harder to reason about. Because evaluation happens outside of the instantiation phase, ES modules introduce a kind of asynchrony that wasn’t present in CommonJS modules. But this doesn’t mean that every part of the process needs to be asynchronous. It depends on what’s doing the loading. The loader controls exactly how the modules are loaded, and it calls the ES module methods to parse and evaluate the code. There is ongoing work to make sure that module specifiers work correctly across all platforms. Overall, ES modules provide a better way to organize and share variables and functions, while making it easier to break up your code into small chunks that can work independently of each other.

To top