Conversation
… loaded via `loadEnv`.
| exclude: ['esm-env'] | ||
| } | ||
| }); No newline at end of file | ||
| export default defineConfig(({ mode }) => { |
There was a problem hiding this comment.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
| import tailwindcss from '@tailwindcss/vite'; | ||
| import { sveltekit } from '@sveltejs/kit/vite'; | ||
| import { defineConfig } from 'vite'; | ||
| import { defineConfig, loadEnv } from 'vite'; |
There was a problem hiding this comment.
'import' is only available in ES6 (use 'esversion: 6').
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe vite.config.js was refactored from a static configuration object to a dynamic function-based approach that accepts the mode parameter, loads environment variables via loadEnv, and updates Sentry plugin configuration to use environment-loaded values instead of process.env. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the frontend Vite configuration to load Sentry source map upload settings from environment variables (via loadEnv) instead of relying directly on process.env.
Changes:
- Switch
vite.config.jsto usedefineConfig(({ mode }) => ...)and load env vialoadEnv. - Provide
SENTRY_AUTH_TOKENto the Sentry plugin viasourceMapsUploadOptions.authToken. - Keep source map auto-upload toggled by presence of
PUBLIC_SENTRY_DSN.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| }); No newline at end of file | ||
| export default defineConfig(({ mode }) => { | ||
| const env = loadEnv(mode, process.cwd(), ''); |
There was a problem hiding this comment.
loadEnv(mode, process.cwd(), '') makes the env file lookup dependent on the current working directory. In a monorepo/CI this can end up loading /.env* from the repo root instead of frontend/.env*, causing Sentry upload config to silently differ across environments. Consider resolving envDir relative to this config file (e.g., via new URL('.', import.meta.url) + fileURLToPath) so env loading is stable regardless of where the command is invoked from.
| org: "micropyramid-fa", | ||
| project: "bottlecrm-app", |
There was a problem hiding this comment.
The PR description/title indicates Sentry source map upload configuration is environment-variable driven, but org and project are still hard-coded here. Either move these to env vars as well (so builds across forks/staging can configure without code changes) or adjust the PR description to reflect that only the auth token/enablement is env-configured.
| return { | ||
| plugins: [sentrySvelteKit({ | ||
| org: "micropyramid-fa", | ||
| project: "bottlecrm-app", |
There was a problem hiding this comment.
This introduces a dependency on SENTRY_AUTH_TOKEN, but that variable isn't documented anywhere in the frontend setup docs/templates (e.g., frontend/.env.example). Please add it (commented) to the relevant env template or documentation so deploy/CI configuration is discoverable.
| project: "bottlecrm-app", | |
| project: "bottlecrm-app", | |
| // SENTRY_AUTH_TOKEN is required for uploading source maps to Sentry. | |
| // Ensure this is set in your environment and documented in the frontend env template (e.g. .env.example) |
… loaded via
loadEnv.Summary by CodeRabbit