Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto browserify included in bundle: Around 130kB of JS added #332

Closed
Gp2mv3 opened this issue Dec 8, 2022 · 6 comments · Fixed by #333
Closed

Crypto browserify included in bundle: Around 130kB of JS added #332

Gp2mv3 opened this issue Dec 8, 2022 · 6 comments · Fixed by #333

Comments

@Gp2mv3
Copy link
Contributor

Gp2mv3 commented Dec 8, 2022

Describe the bug
I think my fix in commit eae8c74 increased the bundle size because of crypto-browserify.

To Reproduce
Steps to reproduce the behavior:

  1. Analyze your bundle size with the package in version 1.9.1
  2. Remove the "withExportImages" plugin
  3. Re-analyze the bundle size

Expected behavior
There should be an impact but not that big. We don't need the full crypto package for a simple sha hash.

@dc7290
Copy link
Owner

dc7290 commented Dec 8, 2022

@Gp2mv3
Thanks for the research!

How much does it actually increase in size?

dc7290 added a commit that referenced this issue Dec 8, 2022
@Gp2mv3
Copy link
Contributor Author

Gp2mv3 commented Dec 8, 2022

Wow, you fixed it super fast!
I was considering using hashCode() but your fix seems better.

Here is an example on my build:
Screenshot from 2022-12-08 16-24-10
Screenshot from 2022-12-08 16-24-04

@dc7290
Copy link
Owner

dc7290 commented Dec 8, 2022

Thanks for sharing the bundle size!

As for my earlier commit, it turns out that it was not resolved.
(On the contrary, it turns out that fs-extra is also included in the client bundle😇)
So, fundamentally, I felt that SWC needs to be able to remove the code used only on the server side.

@dc7290
Copy link
Owner

dc7290 commented Dec 8, 2022

vercel/next.js#36514

@dc7290
Copy link
Owner

dc7290 commented Dec 8, 2022

@Gp2mv3

For all the above reasons, please create a PR using hashCode!
Thanks!!

Gp2mv3 added a commit to Gp2mv3/next-export-optimize-images that referenced this issue Dec 8, 2022
Uses hashCode instead of sha1 for external images

✅Closes: dc7290#332
github-actions bot pushed a commit that referenced this issue Dec 11, 2022
## [1.9.2](v1.9.1...v1.9.2) (2022-12-11)

### Bug Fixes

* 🐛 Removed crypto dependency from client bundle ([ca4ea71](ca4ea71)), closes [#332](#332)
* **deps:** update dependency got to ^11.8.6 ([3af53e8](3af53e8))
@github-actions
Copy link

🎉 This issue is included in version v1.9.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants