A bundler turns the files you write into the files a browser should download. It starts from an entry point, follows every import into your own modules and node_modules, transforms what browsers cannot run (TypeScript, JSX, Sass 22,539 , the newest syntax), removes code nothing uses, and writes a few minified, content-hashed files with source maps that lead the debugger back to your originals (Console and Sources).
Early bundlers such as Browserify 169,830 and webpack 3,824 existed because browsers had no module system at all. Since 2018 every major browser has supported <script type="module">, so the job has shifted from making modules possible to making them fast: fewer round trips, smaller payloads and near-instant rebuilds while you edit.