Looking from the vantage point of webpack, here is the chronological list of approaches, techniques, best practices, and patterns that were added to the JS ecosystem, which led to the current state of things:
- The script tag as the answer to adding interactivity to web pages
- Immediately invoked function expressions as the answer to modularizing libraries and avoiding code collisions
- The problem with IIFEs
- Sharing third-party libraries in a team environment with NPM
- JS task runners and NPM scripts
- Modules in JS
Let's look at each one of these solutions in more detail.