@sentry/nextjs
Version:
Official Sentry SDK for Next.js
32 lines (28 loc) • 1.31 kB
JavaScript
Object.defineProperty(exports, '__esModule', { value: true });
const react = require('@sentry/react');
const nextRoutingInstrumentation = require('./routing/nextRoutingInstrumentation.js');
/**
* A custom BrowserTracing integration for Next.js.
*/
class BrowserTracing extends react.BrowserTracing {
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
[...react.defaultRequestInstrumentationOptions.tracingOrigins, /^(api\/)/],
routingInstrumentation: nextRoutingInstrumentation.nextRouterInstrumentation,
...options,
});
}
}
exports.BrowserTracing = BrowserTracing;
//# sourceMappingURL=browserTracingIntegration.js.map