-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(nextjs): Fix types in config code #4057
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
Merged
Merged
Conversation
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
size-limit report
|
# Conflicts: # packages/nextjs/test/config.test.ts
90fc36b
to
1b46c28
Compare
kamilogorek
approved these changes
Oct 12, 2021
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.
Looks good and all tests, including integration tests for next.js are passing, so 👍
iker-barriocanal
approved these changes
Oct 12, 2021
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.
🚀
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.
This cleans up the types we use in
withSentryConfig
and friends. Three specific changes:When a user passes their nextjs config to nextjs, they're free to specify as few or as many of the options as they like. Nextjs config objects provided directly by nextjs, on the other hand, will always have certain properties, because they will have been filled in with defaults if not specified by the user. This differentiates between these two cases, through the use of the
Partial< ... >
utility type when describing config provided by the user.In order to play more nicely with
@sentry/webpack-plugin
and its types, this uses the officialWebpackPluginInstance
type from webpack itself. This requires including webpack as a dependency, in this case a peer dependency, since we're only using it for its types and therefore don't actually care if it's installed or not. (Given nextjs's reliance on it, you might be asking yourself how a nextjs user would ever not have it already installed, and the answer is that nextjs ships with a precompiled version and therefore doesn't include it as anything other than a dev dependency.)Given that we still support webpack 4, this ramps our types dev dependency down to the lowest version which includes the compatibility type
WebpackPluginInstance
.