diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..20f05c1 --- /dev/null +++ b/.env.production.example @@ -0,0 +1,3 @@ +SENTRY_PROJECT= # Sentry Project +SENTRY_AUTH_TOKEN= # Sentry Auth Token +SENTRY_ORG= # Sentry Organization diff --git a/src/AdminApp.tsx b/src/AdminApp.tsx index 65d6bb4..24a3a52 100644 --- a/src/AdminApp.tsx +++ b/src/AdminApp.tsx @@ -12,6 +12,13 @@ import 'react-toastify/dist/ReactToastify.css'; const AdminApp = () => { return ( + diff --git a/vite.config.ts b/vite.config.ts index 3978a3c..7bd1f23 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,34 +1,42 @@ /// import { sentryVitePlugin } from '@sentry/vite-plugin'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'path'; // https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - react({ - jsxImportSource: '@emotion/react', - }), - sentryVitePlugin({ - org: 'oceanletter-y1', - project: 'oceanletter-react', - }), - ], +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ''); - resolve: { - alias: { - '@': path.resolve(__dirname, './src'), + return { + resolve: { + alias: { + '@': path.resolve(__dirname, './src'), + }, }, - }, - test: { - globals: true, - environment: 'jsdom', - setupFiles: ['./src/setupTests.ts'], - }, + test: { + globals: true, + environment: 'jsdom', + setupFiles: ['./src/setupTests.ts'], + }, + + build: { + sourcemap: true, + }, - build: { - sourcemap: true, - }, + plugins: [ + react({ + jsxImportSource: '@emotion/react', + }), + sentryVitePlugin({ + org: env.SENTRY_ORG, + project: env.SENTRY_PROJECT, + authToken: env.SENTRY_AUTH_TOKEN, + sourcemaps: { + filesToDeleteAfterUpload: ['**/*.js.map'], + }, + }), + ], + }; });