Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

build: support sourcemap in sentry (#1910)

Himself652bcda973d376
diff --git a/apps/web/.env.local.template b/apps/web/.env.local.template
index 19915e2e9d..7e6a0bf4f3 100644
--- a/apps/web/.env.local.template
+++ b/apps/web/.env.local.template
@@ -20,4 +20,6 @@ ENABLE_CHANGELOG=1
# Sentry
SENTRY_AUTH_TOKEN=
+SENTRY_ORG=
+SENTRY_PROJECT=
NEXT_PUBLIC_SENTRY_DSN=
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index 9500abbb18..5e1e1c3462 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -4,6 +4,7 @@ import path from 'node:path';
import { PerfseePlugin } from '@perfsee/webpack';
import { withSentryConfig } from '@sentry/nextjs';
+import SentryWebpackPlugin from '@sentry/webpack-plugin';
import debugLocal from 'next-debug-local';
import preset from './preset.config.mjs';
@@ -113,6 +114,19 @@ const nextConfig = {
config.plugins = [perfsee];
}
}
+ if (
+ process.env.SENTRY_AUTH_TOKEN &&
+ process.env.SENTRY_ORG &&
+ process.env.SENTRY_PROJECT
+ ) {
+ config.plugins.push(
+ new SentryWebpackPlugin({
+ include: '.next',
+ ignore: ['node_modules', 'cypress', 'test'],
+ urlPrefix: '~/_next',
+ })
+ );
+ }
return config;
},
diff --git a/apps/web/package.json b/apps/web/package.json
index ab5d992879..0e003a5ab1 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -50,6 +50,7 @@
"@perfsee/webpack": "^1.5.0",
"@redux-devtools/extension": "^3.2.5",
"@rich-data/viewer": "^2.15.6",
+ "@sentry/webpack-plugin": "^1.20.0",
"@swc-jotai/debug-label": "^0.0.9",
"@swc-jotai/react-refresh": "^0.0.7",
"@types/react": "=18.0.31",
diff --git a/yarn.lock b/yarn.lock
index f014671b4f..04489e861f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -198,6 +198,7 @@ __metadata:
"@redux-devtools/extension": ^3.2.5
"@rich-data/viewer": ^2.15.6
"@sentry/nextjs": ^7.47.0
+ "@sentry/webpack-plugin": ^1.20.0
"@swc-jotai/debug-label": ^0.0.9
"@swc-jotai/react-refresh": ^0.0.7
"@toeverything/hooks": "workspace:*"
@@ -4950,7 +4951,7 @@ __metadata:
languageName: node
linkType: hard
-"@sentry/webpack-plugin@npm:1.20.0":
+"@sentry/webpack-plugin@npm:1.20.0, @sentry/webpack-plugin@npm:^1.20.0":
version: 1.20.0
resolution: "@sentry/webpack-plugin@npm:1.20.0"
dependencies: