Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(nextjs): Make Next.js types isomorphic#6707
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
7e5765aa91da169fb471d89f5e790ec79607af6c7b14469f64a6acd72be79a577078ca7417c5422a20097774fa5339f4bc74d845e6b033d47337595837fe928f837a4f8e6d72ce5df30c35b7d7c594c2f490ce16File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export type { SentryWebpackPluginOptions } from './types'; | ||
| export { withSentryConfig } from './withSentryConfig'; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './config'; | ||
| export * from './server'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* eslint-disable import/export */ | ||
| // We export everything from both the client part of the SDK and from the server part. Some of the exports collide, | ||
| // which is not allowed, unless we redifine the colliding exports in this file - which we do below. | ||
| export * from './config'; | ||
| export * from './client'; | ||
| export * from './server'; | ||
| import type { Integration, Options, StackParser } from '@sentry/types'; | ||
| import type { BrowserOptions } from './client'; | ||
| import * as clientSdk from './client'; | ||
| import type { NodeOptions } from './server'; | ||
| import * as serverSdk from './server'; | ||
| /** Initializes Sentry Next.js SDK */ | ||
| export declare function init(options: Options | BrowserOptions | NodeOptions): void; | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: Can this just be ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I would also do it that way but we defined it as such up until now and didn't want this PR to turn into a breaking change. | ||
| // We export a merged Integrations object so that users can (at least typing-wise) use all integrations everywhere. | ||
| export const Integrations = { ...clientSdk.Integrations, ...serverSdk.Integrations }; | ||
AbhiPrasad marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| export declare const defaultIntegrations: Integration[]; | ||
| export declare const defaultStackParser: StackParser; | ||
| // This variable is not a runtime variable but just a type to tell typescript that the methods below can either come | ||
| // from the client SDK or from the server SDK. TypeScript is smart enough to understand that these resolve to the same | ||
| // methods from `@sentry/core`. | ||
| declare const runtime: 'client' | 'server'; | ||
| export const close = runtime === 'client' ? clientSdk.close : serverSdk.close; | ||
| export const flush = runtime === 'client' ? clientSdk.flush : serverSdk.flush; | ||
| export const lastEventId = runtime === 'client' ? clientSdk.lastEventId : serverSdk.lastEventId; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import { NEXT_PHASE_PRODUCTION_BUILD } from './phases'; | ||
| import { PHASE_PRODUCTION_BUILD } from 'next/constants'; | ||
| /** | ||
| * Decide if the currently running process is part of the build phase or happening at runtime. | ||
| */ | ||
| export function isBuild(): boolean { | ||
| return process.env.NEXT_PHASE === NEXT_PHASE_PRODUCTION_BUILD; | ||
| return process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.