Demonstrate how you would optimize a web application to reduce bundle size and improve load times.
Implement the dependency analysis described below. Given modules with sizes and dependencies, compute the initial bundle, shared lazy modules, each route's lazy chunk, and the resulting sizes. A module belongs in the shared chunk when at least two lazy routes require it, unless it is already in the initial bundle. Return module names in sorted order.
def optimize_bundles(modules, initial_entries, lazy_entries):