Skip to content
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): Don't rexport default in route handlers #8924

Merged
merged 6 commits into from Sep 5, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Aug 31, 2023

Seems like Next.js doesn't like it if we export defaults in route handlers: https://github.com/getsentry/sentry-javascript/actions/runs/6031414061/job/16365451995

It appears this is only an error message in dev mode as of now, but we should fix it nonetheless in case it becomes an actual error at some point.

Fixes #8934

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 75.32 KB (0%)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.21 KB (0%)
@sentry/browser - Webpack (gzipped) 21.83 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 69.84 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.16 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.15 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 220.72 KB (0%)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 85 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 59.71 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 31.06 KB (+0.01% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 75.34 KB (0%)
@sentry/react - Webpack (gzipped) 21.86 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 93.2 KB (0%)
@sentry/nextjs Client - Webpack (gzipped) 50.78 KB (0%)

@@ -58,16 +58,20 @@ function wrapHandler<T>(handler: T, method: 'GET' | 'POST' | 'PUT' | 'PATCH' | '
});
}

// Re-export anything exported by the page module we're wrapping. When processing this code, Rollup is smart enough to
// not include anything whose name matchs something we've explicitly exported above.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a bystander reading this but maybe you can remove the " above" bit at the end since the comment has moved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yea. Thanks <3

packages/nextjs/src/config/loaders/wrappingLoader.ts Outdated Show resolved Hide resolved
packages/nextjs/src/config/loaders/wrappingLoader.ts Outdated Show resolved Hide resolved
lforst and others added 2 commits September 5, 2023 10:05
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@lforst lforst enabled auto-merge (squash) September 5, 2023 08:16
@lforst lforst merged commit b57e139 into develop Sep 5, 2023
45 checks passed
@lforst lforst deleted the lforst-fix-nextjs-default-export branch September 5, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error Detected default export in '...'. Export a named export for each HTTP method instead.
3 participants