-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Sentry example: add js types to SentryWebpackPluginOptions #28726
Conversation
Enables code completion in Visual Studio Code (and perhaps other editors)
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.
Thanks!
Looks great, But I don't think it works if you enable Could you try ? The type SentryWebpackPluginOptions is a re-export from SentryCliPluginOptions from @sentry/webpack-plugin When the options are typed, it will require the "include" property Not sure if it can be changed upstream ... Any idea ? |
@belgattitude thanks for the heads up! I have never used Anyway, you're totally right, in @sentry/nextjs they use |
Work perfect. That's great I didn't know we could add Partial there. So all fine... BTW, I would studlyCaps the const: |
@belgattitude, I am making some other small changes to the example, and have included that fix: #28359 |
Failing test suitesCommit: 8bee034
Expand output● Custom routes › dev mode › should handle external beforeFiles rewrite correctly
● Custom routes › dev mode › should match has query redirect with duplicate query key
● Custom routes › server mode › should match has query redirect with duplicate query key
● Custom routes › serverless mode › should match has query redirect with duplicate query key
Read more about building and testing Next.js in contributing.md. |
Using this in https://github.com/dtpstat/website/blob/c3c4b07ccaf3e8c400ef2c9523d1517d0277fe8c/next.config.mjs#L80-L83. Works like a charm, so thanks for updating the example! |
Stats from current PRDefault Build (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 16.7s | 19s | |
buildDurationCached | 6.3s | 6.8s | |
nodeModulesSize | 359 MB | 359 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.748 | 3.999 | |
/ avg req/sec | 666.97 | 625.1 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.772 | 1.989 | |
/error-in-render avg req/sec | 1410.48 | 1257.19 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
450.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42 kB | 42 kB | ✓ |
main-HASH.js gzip | 27.9 kB | 27.9 kB | ✓ |
webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
Overall change | 71.5 kB | 71.5 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.36 kB | 1.36 kB | ✓ |
_error-HASH.js gzip | 194 B | 194 B | ✓ |
amp-HASH.js gzip | 312 B | 312 B | ✓ |
css-HASH.js gzip | 326 B | 326 B | ✓ |
dynamic-HASH.js gzip | 2.57 kB | 2.57 kB | ✓ |
head-HASH.js gzip | 350 B | 350 B | ✓ |
hooks-HASH.js gzip | 919 B | 919 B | ✓ |
image-HASH.js gzip | 5.01 kB | 5.01 kB | ✓ |
index-HASH.js gzip | 263 B | 263 B | ✓ |
link-HASH.js gzip | 2.26 kB | 2.26 kB | ✓ |
routerDirect..HASH.js gzip | 321 B | 321 B | ✓ |
script-HASH.js gzip | 383 B | 383 B | ✓ |
withRouter-HASH.js gzip | 318 B | 318 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 14.7 kB | 14.7 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 459 B | 459 B | ✓ |
Overall change | 459 B | 459 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 531 B | 531 B | ✓ |
link.html gzip | 544 B | 544 B | ✓ |
withRouter.html gzip | 526 B | 526 B | ✓ |
Overall change | 1.6 kB | 1.6 kB | ✓ |
Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 21.9s | 22.2s | |
buildDurationCached | 7.3s | 7s | -331ms |
nodeModulesSize | 359 MB | 359 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 4.042 | 3.974 | -0.07 |
/ avg req/sec | 618.45 | 629.03 | +10.58 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 2.033 | 2.063 | |
/error-in-render avg req/sec | 1229.52 | 1211.67 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
450.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.1 kB | 42.1 kB | ✓ |
main-HASH.js gzip | 27.9 kB | 27.9 kB | ✓ |
webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
Overall change | 71.6 kB | 71.6 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.35 kB | 1.35 kB | ✓ |
_error-HASH.js gzip | 180 B | 180 B | ✓ |
amp-HASH.js gzip | 305 B | 305 B | ✓ |
css-HASH.js gzip | 321 B | 321 B | ✓ |
dynamic-HASH.js gzip | 2.56 kB | 2.56 kB | ✓ |
head-HASH.js gzip | 342 B | 342 B | ✓ |
hooks-HASH.js gzip | 911 B | 911 B | ✓ |
image-HASH.js gzip | 5.05 kB | 5.05 kB | ✓ |
index-HASH.js gzip | 256 B | 256 B | ✓ |
link-HASH.js gzip | 2.28 kB | 2.28 kB | ✓ |
routerDirect..HASH.js gzip | 314 B | 314 B | ✓ |
script-HASH.js gzip | 375 B | 375 B | ✓ |
withRouter-HASH.js gzip | 309 B | 309 B | ✓ |
85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
Overall change | 14.7 kB | 14.7 kB | ✓ |
Client Build Manifests
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 458 B | 458 B | ✓ |
Overall change | 458 B | 458 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | Skn0tt/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 533 B | 533 B | ✓ |
link.html gzip | 547 B | 547 B | ✓ |
withRouter.html gzip | 527 B | 527 B | ✓ |
Overall change | 1.61 kB | 1.61 kB | ✓ |
@lobsterkatie wdyt, is it safe to import types from @sentry/nextjs like this? |
As far as I know, but I'll admit, I don't have much experience with that syntax. ( It seems like the folks above have it working, though.) But I'm a little confused why this is even necessary. I haven't done anything special that I know of to my test app, and I get types on the config object: |
@lobsterkatie ah, it works if you define the Sentry options inline, and not create a |
Oh, okay. Yeah, this makes sense actually. When it's part of the As to the correct fix, one easy thing I can do is to export that type. Past that, I don't have a strong opinion on which way it should be written. If you are going to go the docstring route, though, I'd wait until the type is exported, because it will make it much cleaner. I'm going to push a PR for that now, and it'll go out in the next release (which will either be 6.17.10 or 6.18). |
This will allow people who want typing in their `next.config.js` file to have it without digging into `dist`. See vercel/next.js#28726.
Perfect, thanks! I'll update this PR when it is released. |
My suggestion here would be to just inline the config, then no extra import is needed 👍 |
@balazsorban44 good call, I guess users who need to extract the config can get the TS type from (Also, nice sweater!) |
Thanks for the PR and thanks about the sweater! 🇳🇴 |
Enables code completion in Visual Studio Code (and perhaps other editors)
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples