-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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): Pull transpileClientSDK
option from correct location
#5516
fix(nextjs): Pull transpileClientSDK
option from correct location
#5516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once tests pass
|
||
// Next 12.2.3+ warns about non-canonical properties on `userNextConfig`, so grab and then remove the `sentry` | ||
// property there. Where we actually need it is in the webpack config function we're going to create, so pass it | ||
// to `constructWebpackConfigFunction` so that it will be in the created function's closure. | ||
const { sentry: userSentryOptions } = userNextConfigObject; | ||
delete userNextConfigObject.sentry; | ||
// Remind TS that there's now no `sentry` property | ||
userNextConfigObject = userNextConfigObject as NextConfigObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just do ...(userNextConfigObject as NextConfigObject)
? I'd rather not change from const
-> let
we can also just declare a new var - modifiedUserNextConfigObject
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not change from
const
->let
Why?
(FYI: I'm going to merge this regardless, because I'd like to get this bugfix out, but we can always revisit it later.)
990361f
to
4481089
Compare
In the process of working simultaneously on both #5472 (which adds the
sentry.transpileClientSDK
option tonext.config.js
) and #5473 (which moves thesentry
options object fromnext.config.js
to a new location halfway through the build process, in order to prevent nextjs from throwing warnings), I missed their overlap. As a result, thetranspileClientSDK
option is still currently being retrieved from the old, pre-move location, even though said retrieval happens in the second half of the build, after the move. (Unsurprisingly, it's therefore always undefined, rendering it useless).This fixes that by pulling it from the new, correct location instead. It also adjusts our types so that future mistakes like this will show up as errors, by creating separate pre-move and post-move
userNextConfig
types and using them as appropriate.Fixes #5452.