okikio / bundlejs

An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
https://bundlejs.com
MIT License
751 stars 13 forks source link

Option to exclude peer dependencies + package composition #22

Closed atomiks closed 2 years ago

atomiks commented 2 years ago

@floating-ui/react-dom is ~5 kB with everything exported, but displays 52.2 kB because React+React DOM are included in the bundle.

Further, a breakdown of the package composition would be good (like webpack-bundle-analyzer) to see which dependencies are the largest of a package. That would make this more obvious

atomiks commented 2 years ago

I just saw #13 is about peerDependencies. Clicking the settings icon and adding them to the "external" key works:

"esbuild": {
  "external": ["react", "react-dom"],

@okikio maybe add this to the docs?

The package composition feature would still be cool though 👍

okikio commented 2 years ago

I'm currently working on a massive blog posts that will detail all the hidden features in bundlejs.

You may not know this but you can also use aliases in bundlejs.

{
    "aliases": { "@okikio/animate": "react-dom" },
    "esbuild": { ... }
}

I'll look into a package composition analyzer.

okikio commented 2 years ago

The source of difficulty in implementing a package composition analyzer is the creation of a graph, I'd appreciate it if you or really anyone could design a graph for it, it's quite a bit of work....Lol 😅.

atomiks commented 2 years ago

@okikio 😰 I have no experience in this area so if it's too hard feel free to close

okikio commented 2 years ago

@atomiks I've put out a call to collaborate, maybe share it around with other peeps and lets see if we can make magic happen.

twitter.com/jsbundle/status/1520921432112443392

okikio commented 2 years ago

@atomiks I've found someone willing to collaborate with me to implement a package composition graph.

Also, I've added docs about aliases and externals to bundlejs

okikio commented 2 years ago

Since, this feature is already public, I'll close this