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

[Bug 🐞] Failed to fetch dependencies #36

Closed harrytran998 closed 1 year ago

harrytran998 commented 2 years ago

Hi @bundlejs, thanks for your great tool. Today I checked my small UI library - wrap of Material UI --> But I have the error like the image below. I hope you can check that!

image

Link: https://bundlejs.com/?q=%40onemind%2Fui

okikio commented 2 years ago

@harrytran998 Unfortunately, this doesn't seem to be something I can fix. It seems due to the high number of packages and the even higher number of network requests, browsers are basically giving up. I'll try to optimize the fetch process but I'm not sure I can actually fix this problem.

A possible solution may be to pre-bundle Material UI, and then use it in your library, esbuild will automatically treeshake the unused parts of Material UI. Material UI as a set of 8K+ modules is too much for browsers to handle.

image
okikio commented 2 years ago

After a bit of research I've determined I can't fix this, at least not while bundlejs is running in a browser. I'll look into other alternative solutions to fix this.

harrytran998 commented 2 years ago

Thanks for your quick response. I think your solution is valid for now(call HTTP in browser). So I will try to pre-bundle MUI. But if you find something interesting alternative solutions, pls let's me know 😆 🙏.

okikio commented 1 year ago

@harrytran998 It's now fixed, give it a try https://bundlejs.com/?q=@onemind/ui&bundle

okikio commented 1 year ago

Please let me know if you run into this problem again

harrytran998 commented 1 year ago

Thanks for your work on this 😆 I checked it and everything ok! How do you handle this without call HTTP like before?

okikio commented 1 year ago

I made the package fetching algorithm more specific than before, allowing it to avoid fetching packages that could just be ignored or treeshaken away

harrytran998 commented 1 year ago

thanks for your hard work <3