Hosting bundle-buddy and viewing stats using JSON file.
reznord opened this issue · comments
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...
-
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>
-
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
- add a new flag for --standalone-bundle
- 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.
- 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.