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

fix(nextjs): Stop using eval when checking for sentry-cli binary #5447

Merged
merged 1 commit into from Jul 22, 2022

Conversation

lobsterkatie
Copy link
Member

In #4988, we switched to using eval in ensureCLIBinaryExists (called by our build-time config code in the nextjs SDK), in order to prevent Vercel's dependency-tracing algorithm from thinking the binary was a (n enormous) dependency and including it in people's serverless functions. (It was getting tricked by the require.resolve() call; turning that call into a string was the only way we could find to hide it from the algorithm.)

But eval is kind of gross. And Rollup, which agrees it's gross, keeps yelling at us for using it. In order to suppress the warnings and generally clean things up, this replaces the eval with real code again, and in that real code replaces the require.resolve() call with a manual check of all of the paths require.resolve() would consider. No require means no confused algorithm means no erroneously bundled cli binary in Vercel. And no eval means happy Rollup means happy us, because now it's easier to see when the build has legit errors. Wins all around.

@lobsterkatie lobsterkatie requested a review from Lms24 July 22, 2022 03:59
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wins all around

I couldn't agree more! 🚀

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

Successfully merging this pull request may close these issues.

None yet

2 participants