feat: sentry integration (#51)
* feat: integrate sentry error reporting * feat: report logger errors to sentry with 30s log context
This commit is contained in:
22 files changed
+2143
-227
No files matched your search
+45
-20
@@ -1,28 +1,53 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
||||
import path from 'path';
|
||||
import { codeInspectorPlugin } from 'code-inspector-plugin';
|
||||
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
tanstackRouter({
|
||||
target: 'react',
|
||||
autoCodeSplitting: true,
|
||||
}),
|
||||
tailwindcss(),
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['babel-plugin-react-compiler'],
|
||||
},
|
||||
}),
|
||||
codeInspectorPlugin({ bundler: 'vite' }),
|
||||
],
|
||||
resolve: {
|
||||
preserveSymlinks: true,
|
||||
alias: {
|
||||
'@': path.resolve(process.cwd(), './src'),
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '');
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
sentryVitePlugin({
|
||||
org: process.env.SENTRY_ORG || env.SENTRY_ORG,
|
||||
project: process.env.SENTRY_PROJECT || env.SENTRY_PROJECT,
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN || env.SENTRY_AUTH_TOKEN,
|
||||
release: {
|
||||
name: `${process.env.npm_package_name}@${process.env.npm_package_version}`,
|
||||
},
|
||||
// Electron loads files from app://, so we need to normalize paths for Source Map matching
|
||||
sourcemaps: {
|
||||
// Rewrite the source paths to strip the Electron app:// protocol
|
||||
rewriteSources: (source) => {
|
||||
// Transform: app:///.vite/renderer/main_window/assets/index.js
|
||||
// Into: ~/.vite/renderer/main_window/assets/index.js
|
||||
return source.replace(/^app:\/\/\//, '~/');
|
||||
},
|
||||
},
|
||||
}),
|
||||
tanstackRouter({
|
||||
target: 'react',
|
||||
autoCodeSplitting: true,
|
||||
}),
|
||||
tailwindcss(),
|
||||
react({
|
||||
babel: {
|
||||
plugins: ['babel-plugin-react-compiler'],
|
||||
},
|
||||
}),
|
||||
codeInspectorPlugin({ bundler: 'vite' }),
|
||||
],
|
||||
define: {
|
||||
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN || env.SENTRY_DSN),
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
preserveSymlinks: true,
|
||||
alias: {
|
||||
'@': path.resolve(process.cwd(), './src'),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user