What is exactly a bundler?

I am pretty confused about what a bundler really is and mostly its difference, if there is, between a package manager? Is bun for instance a bundler?

I haven't found yet a clear explanation resolving my hesitations.

Thanks in advance.


  • Package Manager: Manages and installs software packages and libraries.

    Bundler: Optimizes and bundles assets like JavaScript and CSS files in web development ("doing minify & uglify and all of those things").

    for exmaple :

    npm is a package manager while webpack is the bundler that is the most famous used with npm.

    concerning bun its all in one its mainly a package manager but it has it`s own bundler inside.

    more info in it`s docs here Bun docs