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

feat(webpack): Add Sentry Webpack Plugin #76051

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions babel.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,12 @@ const config: TransformOptions = {
plugins: ['@emotion/babel-plugin', '@babel/plugin-transform-runtime'],
env: {
production: {
plugins: [
['babel-plugin-add-react-displayname'],
'@sentry/babel-plugin-component-annotate',
],
plugins: [['babel-plugin-add-react-displayname']],
},
development: {
plugins: [
'@emotion/babel-plugin',
'@babel/plugin-transform-react-jsx-source',
'@sentry/babel-plugin-component-annotate',
...(process.env.SENTRY_UI_HOT_RELOAD ? ['react-refresh/babel'] : []),
],
},
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
"@sentry-internal/rrweb": "2.25.0",
"@sentry-internal/rrweb-player": "2.25.0",
"@sentry-internal/rrweb-snapshot": "2.25.0",
"@sentry/babel-plugin-component-annotate": "^2.16.1",
"@sentry/core": "^8.24.0",
"@sentry/node": "^8.24.0",
"@sentry/react": "^8.24.0",
"@sentry/release-parser": "^1.3.1",
"@sentry/status-page-list": "^0.3.0",
"@sentry/types": "^8.24.0",
"@sentry/utils": "^8.24.0",
"@sentry/webpack-plugin": "^2.22.2",
"@spotlightjs/spotlight": "^2.0.0-alpha.1",
"@tanstack/react-query": "^4.29.7",
"@tanstack/react-query-devtools": "^4.36.1",
Expand Down Expand Up @@ -263,9 +263,7 @@
"last 3 iOS major versions",
"Firefox ESR"
],
"test": [
"current node"
]
"test": ["current node"]
},
"volta": {
"extends": ".volta.json"
Expand Down
4 changes: 4 additions & 0 deletions static/app/bootstrap/initializeSdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ function getSentryIntegrations(routes?: Function) {
},
}),
Sentry.browserProfilingIntegration(),
Sentry.thirdPartyErrorFilterIntegration({
filterKeys: ['sentry-spa'],
behaviour: 'apply-tag-if-contains-third-party-frames',
}),
];

return integrations;
Expand Down
20 changes: 20 additions & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import {WebpackReactSourcemapsPlugin} from '@acemarke/react-prod-sourcemaps';
import {RsdoctorWebpackPlugin} from '@rsdoctor/webpack-plugin';
import {sentryWebpackPlugin} from '@sentry/webpack-plugin';
import browserslist from 'browserslist';
import CompressionPlugin from 'compression-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
Expand Down Expand Up @@ -812,4 +813,23 @@ if (env.WEBPACK_CACHE_PATH) {
};
}

appConfig.plugins?.push(
sentryWebpackPlugin({
applicationKey: 'sentry-spa',
telemetry: false,
sourcemaps: {
disable: true,
},
release: {
create: false,
},
reactComponentAnnotation: {
enabled: true,
},
bundleSizeOptimizations: {
excludeDebugStatements: IS_PRODUCTION,
},
})
);

export default appConfig;
Loading
Loading