wrap its code and hence creating a private namespace for itself. • It doesn’t address dependency management, meaning which script/module depends upon. • It can lead to namespace collisions like the probability of having two modules can have the same name.
from ﬁles in the same disk because it works synchronously. It wasn’t suitable for the web. • The reason is because loading too many modules will block the main thread and halt the browser until all the dependencies are fetched and parsed.
the module and its dependencies can be asynchronously loaded. This is particularly well suited for the browser environment where synchronous loading of modules incurs performance, usability, debugging, and cross-domain access problems. AMD Asynchronous Module Deﬁnition https://github.com/amdjs/amdjs-api/blob/master/AMD.md
Module Replacement Tree shaking Splitting code into various bundles which can then be loaded on demand or in parallel. • Multiple Entry Points: Manually split code using entry conﬁguration. • Prevent Duplication. • Dynamic Imports with Loading on demand (lazy loading)
browsers • Serving a single ﬁle or multiple ones according to your conﬁguration and preferences. • Bundlers will minify and uglify your output. • Get the beneﬁts of some of the bundlers like • Tree shaking • Code splitting • Hot module replacement
you need to ship your application (debugging, conﬁguring, DX). • Modern browsers run ES6 faster than the compiled code. • Harnessing the power of multiplexing in HTTP2, serving multiple small ﬁles will work faster than serving a single ﬁle or even multiple bundled ﬁles. • Better management for browser caching as only the updated ﬁles will be invalidated, not a whole bunch of bundled ﬁles.