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 takes up the majority of next bundle size #40271

Closed
mcmxcdev opened this issue Sep 6, 2022 · 4 comments
Closed

crypto-browserify takes up the majority of next bundle size #40271

mcmxcdev opened this issue Sep 6, 2022 · 4 comments

Comments

@mcmxcdev
Copy link

mcmxcdev commented Sep 6, 2022

Describe the feature you'd like to request

crypto-browserify didn't have new commits since 2018.

It takes up quite a chunk according to: https://bundlephobia.com/package/crypto-browserify@3.12.0

Also visible as part of @next/bundle-analyzer:
Screenshot from 2022-09-06 16-17-20

Describe the solution you'd like

Switch to an alternative, maintain a fork or drop it altogether.

Describe alternatives you've considered

/

@balazsorban44
Copy link
Member

You are likely using a library that imports crypto even if it's targeted for browsers. Next.js falls back to a polyfill for historical reasons.

You can now opt out of this behavior by setting the experimental.fallbackNodePolyfills: false option in your next.config.js but you'll have to make sure the library or your code does not unnecessarily import crypto then. Read more at #39248

@mcmxcdev
Copy link
Author

mcmxcdev commented Sep 7, 2022

Hey Balasz, thanks for the detailed explanation, I really appreciate it!

Looks like I will have to wait for v12.2.6 to drop to try it out but looks promising ;)

@balazsorban44
Copy link
Member

balazsorban44 commented Sep 7, 2022

You can test it out on next@canary already, or wait for the next latest release, of course. 👍

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants