fix(nextjs): Stop using eval when checking for sentry-cli binary#5447
Merged
lobsterkatie merged 1 commit intomasterfrom Jul 22, 2022
Merged
fix(nextjs): Stop using eval when checking for sentry-cli binary#5447lobsterkatie merged 1 commit intomasterfrom
eval when checking for sentry-cli binary#5447lobsterkatie merged 1 commit intomasterfrom
Conversation
Lms24
approved these changes
Jul 22, 2022
Member
Lms24
left a comment
There was a problem hiding this comment.
Wins all around
I couldn't agree more! 🚀
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #4988, we switched to using
evalinensureCLIBinaryExists(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 therequire.resolve()call; turning that call into a string was the only way we could find to hide it from the algorithm.)But
evalis 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 theevalwith real code again, and in that real code replaces therequire.resolve()call with a manual check of all of the pathsrequire.resolve()would consider. Norequiremeans no confused algorithm means no erroneously bundled cli binary in Vercel. And noevalmeans happy Rollup means happy us, because now it's easier to see when the build has legit errors. Wins all around.