bundle-wizard icon indicating copy to clipboard operation
bundle-wizard copied to clipboard

[feat] export a visualization that works without a server

Open jpvincent opened this issue 5 years ago • 2 comments

Hi! Thank you for the option to save a visualization of a test, it helps sharing and having an history of a project to further compare.

The current exported index.html file can not be simply dragged and dropped to a browser, we have to serve it from an http server in order to see anything. Like webpack-bundle-analyzer, it would be easier to not need a server at all. There is paths problems that can be corrected manually from the exported HTML :

- <script src="/client.a5432830.js">
+ <script src="./client.a5432830.js">

but after this there is more serious issues, the first one coming from Fetching a local file client.a5432830.js:1080 Fetch API cannot load file:///…/dist/treeData.json. URL scheme must be "http" or "https" for CORS request.

The way webpack-bundle-analyzer does it is to put all JS, JSON and even images directly into the HTML, saving the full visualization into one file. Would it be possible to do it this way ?

jpvincent avatar Mar 04 '21 10:03 jpvincent

Hi, I think there are more assets required for bundle wizard than for webpack-bundle-analyzer, so it might be complex. Right now I just build everything with parcel on default settings, and it would probably require some investigation to figure out how to tweak that to get a one-file build. I don't think this is something I will explore, but I'd be open to checking out prs.

aholachek avatar Mar 07 '21 16:03 aholachek

Thanks for the answer and the details, I hope to find some time to propose you something.

Cheers

jpvincent avatar Mar 09 '21 16:03 jpvincent