-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(nextjs): Support distDir
Next.js option
#3990
Conversation
size-limit report
|
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.
Will look at the tests after this
nextProps: string[], | ||
): Partial<SentryWebpackPluginOptions> { | ||
// @ts-ignore '__spreadArray' import from tslib, ts(2343) | ||
const propsToInclude = [...new Set(nextProps)]; |
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.
We don't need to do this, we know that nextProps
will always be unique. I'd rather refer to the global rather than the function arg as well to make the intent as clear as possible.
If you want to enforce that they will be unique, write a test that just checks if SUPPORTED_NEXTJS_PROPERTIES
is all unique.
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.
Actually we could make SUPPORTED_NEXTJS_PROPERTIES
a Set
and then just iterate with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/values
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.
No, we don't know whether they are unique, even if we make SUPPORTED_NEXTJS_PROPERTIES
a Set
. includeNextjsProps
can be called from anywhere (even if it's only used in includeAllNextjsProps
for now, but that's the point of generalizing after all) and with any array.
I've thought about two alternatives here: using a set as the argument type (which I think it's less convenient than using an array), and enforcing it with types (added a comment at the top of the file why this can't be accomplished). So decided this approach is the most suitable and added a test for duplicated keys.
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.
We can possibly enforce it with the types, let chat about it.
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.
Good tests
…s` integration (#4017) This is a follow-up to #3990, which makes sure sourcemaps get uploaded from the correct spot when using the nextjs `distDir` option[1]. To make sure that the filenames in stacktrace frames match the names of said sourcemaps, we use the `RewriteFrames` integration. Up until now, we've been hardcoding the replacement it should make, based on nextjs's default output directory. This makes it dynamic, by injecting code at build time which adds the relevant value into `global`, where it is accessible at runtime when we're instantiating the integration. [1] https://nextjs.org/docs/api-reference/next.config.js/setting-a-custom-build-directory
Add support for setting custom build directories. Although this allows to custom that directory, source maps won't work; supporting them will come in a follow-up PR.