samccone / bundle-buddy

A tool to understand your bundle size and why files are in your bundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hosting bundle-buddy and viewing stats using JSON file.

reznord opened this issue · comments

commented

As of now, we can view the bundle-buddy stats only locally. It would be better to host it remotely (on github pages).

It will be something similar to https://chrisbateman.github.io/webpack-visualizer/

Any suggestions would be great.

I think the flow might be...

  1. a change to the cli to enable a --share flag which would upload the JSON to a gist or somewhere public. We would then print bundle-buddy.firebase.com?remote_url=<SOME_URL>

  2. a change to the frontend to enable lading the JSON from a remote source
    https://github.com/samccone/bundle-buddy/blob/master/viz/src/index.js#L18

--

A smaller first change might just be to enable dragging a file into the browser and reading the file off of disk.

I'd like to see something similar, though the feasibility is low:

I'd like the ability to package up a single HTML file for sharing. In our current setup, we often share the output from webpack-bundle-analyzer, but that doesn't give us the ability to clearly see the shared code between bundles.

Building a standalone html file bundle should be very straightforward. If this is a feature someone would want just let me know.

@samccone yes! I haven't had time to look at the bundle-buddy source yet, so I wasn't certain if it needed a server running or could do without it.

sure.

we have the data here
https://github.com/samccone/bundle-buddy/blob/master/index.ts#L54

then in the viz
https://github.com/samccone/bundle-buddy/blob/master/viz/src/index.js#L18
we hit the network for the JSON.

So the solution is to

  1. add a new flag for --standalone-bundle
  2. inline the JSON in the html and modify this code path to first look for a global DATA and then default to hitting the network.
  3. profit.

Planning to take a pass at inlining the graph data into the HTML template this weekend @samccone .

RE the "single HTML file bundle" idea: we'd need to modify the create-react-app setup to inline the bundled CSS and JS into the built HTML file as well. However, perhaps that can be a separate task.