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

analyze by `import` identifier #38

Closed TomokiMiyauci closed 1 year ago

TomokiMiyauci commented 1 year ago

It seems to recognize the module by its export identifier.

This is a bit odd.

Also, it adds an export { xxx } to the analysis results, which is not needed for actual use, and does not indicate the exact size.

okikio commented 1 year ago

Could you please expand on this

TomokiMiyauci commented 1 year ago

@okikio For example, the following will result in a bundle result of 0. Unused modules will be removed.

import { Result } from "https://deno.land/x/result_js/mod.ts";

This result is correct if i want to know the "bundled result".

My expectation was that the above example would allow me to measure the cost. For example, the following is available: https://github.com/wix/import-cost

This is due to differences in project policies. I realized that what I sought was not the role of this project.

okikio commented 1 year ago

@TomokiMiyauci In a future version having each import display their size write in the bundle may be added as an extra feature, but as of right now you're correct it's a little bit out of scope.

The one thing bundlejs does have is bundle analysis https://twitter.com/okikio_dev/status/1523562099334541313?s=20&t=JPPB2KIF8Wv1tQrJI5rm7w

You can try out bundle analysis https://bundlejs.com/?q=deno:result_js/mod.ts&treeshake=[{+Result+}]&config={"analysis":true}

^ It's not perfect, it doesn't give a perfect treeshake size

TomokiMiyauci commented 1 year ago

@okikio interesting!

^ It's not perfect, it doesn't give a perfect treeshake size

Indeed, the rendering of treemap seems to succeed only once in several times.