@sentry/nextjs
Version:
Official Sentry SDK for Next.js
30 lines (27 loc) • 1.26 kB
JavaScript
import { BrowserTracing as BrowserTracing$1, defaultRequestInstrumentationOptions } from '@sentry/react';
import { nextRouterInstrumentation } from './routing/nextRoutingInstrumentation.js';
/**
* A custom BrowserTracing integration for Next.js.
*/
class BrowserTracing extends BrowserTracing$1 {
constructor(options) {
super({
// eslint-disable-next-line deprecation/deprecation
tracingOrigins:
process.env.NODE_ENV === 'development'
? [
// Will match any URL that contains "localhost" but not "webpack.hot-update.json" - The webpack dev-server
// has cors and it doesn't like extra headers when it's accessed from a different URL.
// TODO(v8): Ideally we rework our tracePropagationTargets logic so this hack won't be necessary anymore (see issue #9764)
/^(?=.*localhost)(?!.*webpack\.hot-update\.json).*/,
/^\/(?!\/)/,
]
: // eslint-disable-next-line deprecation/deprecation
[...defaultRequestInstrumentationOptions.tracingOrigins, /^(api\/)/],
routingInstrumentation: nextRouterInstrumentation,
...options,
});
}
}
export { BrowserTracing };
//# sourceMappingURL=browserTracingIntegration.js.map