Skip to content

Conversation

@steven-pribilinskiy
Copy link

@steven-pribilinskiy steven-pribilinskiy commented Dec 31, 2025

Summary

Add configurable environment variables for frontend development flexibility.

Changes

  • VITE_DEV_PORT: Customize the Vite dev server port (default: 5173)
  • OPEN_DEVTOOLS: Control whether DevTools auto-opens in dev mode (default: true, set to 'false' to disable)

Files Modified

  • apps/frontend/.env.example - Document new env vars
  • apps/frontend/electron.vite.config.ts - Load dotenv and use VITE_DEV_PORT
  • apps/frontend/src/main/index.ts - Respect OPEN_DEVTOOLS setting

Summary by CodeRabbit

  • New Features

    • Configurable dev server port via environment variable (default 5173).
    • DevTools behavior refined: they open only in development mode and when OPEN_DEVTOOLS is not set to 'false'.
  • Documentation

    • Example configuration updated with the two new environment variable options.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link

github-actions bot commented Dec 31, 2025

All contributors have signed the CLA. Thank you!
Posted by the CLA Assistant Lite bot.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Loads environment variables at startup, adds example env entries for VITE_DEV_PORT and OPEN_DEVTOOLS, makes the renderer dev server port configurable via VITE_DEV_PORT, and changes DevTools auto-open to require both is.dev and OPEN_DEVTOOLS !== 'false'.

Changes

Cohort / File(s) Summary
Environment Configuration
apps/frontend/.env.example
Adds commented example variables: VITE_DEV_PORT (default 5173) and OPEN_DEVTOOLS (controls DevTools auto-open).
Build / Dev Dependencies
apps/frontend/package.json
Adds dotenv as a devDependency (^17.2.3).
Vite Electron Config
apps/frontend/electron.vite.config.ts
Calls dotenv.config({ silent: true }) at startup and reads VITE_DEV_PORT to set renderer dev server port (fallback 5173).
Main Process Logic
apps/frontend/src/main/index.ts
Changes DevTools opening condition to require is.dev AND OPEN_DEVTOOLS !== 'false'; no exported/public API changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰
A little env carrot tucked in the ground,
Ports and flags now easy to be found.
Dotenv hums softly, the burrow's aglow,
DevTools open only when breezes show.
I hop, I code, and nibble on change slow.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding configurable dev server port and DevTools control, which are the primary modifications across multiple files in this PR.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eaa6b1d and 89b6478.

⛔ Files ignored due to path filters (1)
  • apps/frontend/package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (2)
  • apps/frontend/package.json
  • apps/frontend/src/main/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/index.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/index.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/index.ts
🔇 Additional comments (2)
apps/frontend/src/main/index.ts (1)

96-96: LGTM! Configurable DevTools behavior works as designed.

The change successfully adds an environment-driven toggle for DevTools, preserving the default behavior (auto-open in dev mode) while allowing developers to opt out by setting OPEN_DEVTOOLS='false'. The implementation matches the documented behavior in .env.example.

Note: A previous review comment suggested handling additional falsy values (case-insensitive, '0', 'no', etc.) as an optional improvement.

apps/frontend/package.json (1)

117-117: dotenv dependency is appropriate and up-to-date.

Version ^17.2.3 is the latest stable release with no known security vulnerabilities. The library is properly used in electron.vite.config.ts for loading environment variables. No action required.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @steven-pribilinskiy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the frontend development workflow by introducing new configuration options via environment variables. Developers now have the flexibility to specify a custom port for the Vite development server and control the automatic opening of DevTools, streamlining their local setup and debugging processes. These changes aim to provide a more adaptable and user-friendly development environment.

Highlights

  • Configurable Vite Dev Server Port: Introduced the VITE_DEV_PORT environment variable, allowing developers to customize the port on which the Vite development server runs. It defaults to 5173 if not specified.
  • Toggleable DevTools Auto-Open: Added the OPEN_DEVTOOLS environment variable, which controls whether Chrome DevTools automatically open when the application is in development mode. Setting it to false will prevent DevTools from opening.
  • Environment Variable Documentation: Updated the .env.example file to include documentation for the new VITE_DEV_PORT and OPEN_DEVTOOLS environment variables, making them discoverable for other developers.
  • Code Readability Improvements: Applied minor reformatting to several join calls and console.log/console.warn statements in src/main/index.ts to enhance code readability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks for your first PR!

A maintainer will review it soon. Please make sure:

  • Your branch is synced with develop
  • CI checks pass
  • You've followed our contribution guide

Welcome to the Auto Claude community!

@steven-pribilinskiy
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces configurable environment variables for the Vite dev server port and auto-opening DevTools, which is a great addition for development flexibility. The implementation is mostly solid, but I've found a potential issue where providing a non-numeric value for the port could crash the dev server. I've left a comment with a suggestion for a more robust implementation. The other changes, including the documentation and the logic for DevTools, look good.

@steven-pribilinskiy steven-pribilinskiy force-pushed the feat/configurable-devtools-and-port branch from f216c06 to 4aee086 Compare December 31, 2025 13:23
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da31b68 and f216c06.

📒 Files selected for processing (3)
  • apps/frontend/.env.example
  • apps/frontend/electron.vite.config.ts
  • apps/frontend/src/main/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/electron.vite.config.ts
  • apps/frontend/src/main/index.ts
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/index.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/index.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.276Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`
📚 Learning: 2025-12-30T16:38:36.276Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.276Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`

Applied to files:

  • apps/frontend/.env.example
🧬 Code graph analysis (1)
apps/frontend/src/main/index.ts (2)
apps/frontend/src/main/ipc-handlers/index.ts (1)
  • setupIpcHandlers (43-110)
apps/frontend/src/main/python-env-manager.ts (1)
  • pythonEnvManager (690-690)
🔇 Additional comments (3)
apps/frontend/.env.example (1)

45-50: LGTM!

The documentation clearly describes the new environment variables with appropriate defaults and usage instructions. The values match the implementation in the config and main files.

apps/frontend/src/main/index.ts (2)

96-98: LGTM!

The DevTools opening condition now correctly respects the OPEN_DEVTOOLS environment variable while maintaining the development mode check. The string comparison with 'false' aligns with the documented behavior in .env.example.


267-274: Verify that usage monitor initialization belongs in this PR.

This code initializes and starts the usage monitor after window creation, which is new functionality not mentioned in the PR objectives (which focus on configurable dev server port and DevTools). While the implementation looks correct, it appears to be scope creep.

Was this change intentionally included, or should it be in a separate PR?

@steven-pribilinskiy steven-pribilinskiy force-pushed the feat/configurable-devtools-and-port branch from 4aee086 to eab8054 Compare December 31, 2025 13:25
@AndyMik90 AndyMik90 self-assigned this Dec 31, 2025
@steven-pribilinskiy steven-pribilinskiy force-pushed the feat/configurable-devtools-and-port branch 2 times, most recently from c38bf87 to 5a6cdc5 Compare December 31, 2025 13:27
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
apps/frontend/electron.vite.config.ts (2)

4-7: Missing dotenv dependency will cause runtime error.

The code imports and invokes dotenv.config(), but dotenv is not listed in apps/frontend/package.json or the root package.json (as confirmed by previous verification). This will cause a "Cannot find module 'dotenv'" error when the config loads.

Add dotenv to devDependencies in apps/frontend/package.json:

"devDependencies": {
  "dotenv": "^16.0.0"
}

62-62: Add port range validation.

While Number() correctly handles non-numeric values via the || fallback, it doesn't validate that the port is within the valid range (1-65535). Setting VITE_DEV_PORT=99999 will cause Vite to fail with a cryptic error.

🔎 Proposed fix with validation
-      port: Number(process.env.VITE_DEV_PORT) || 5173,
+      port: (() => {
+        const port = Number(process.env.VITE_DEV_PORT);
+        if (isNaN(port) || port < 1 || port > 65535) {
+          if (process.env.VITE_DEV_PORT) {
+            console.warn(`Invalid VITE_DEV_PORT: ${process.env.VITE_DEV_PORT}, using default 5173`);
+          }
+          return 5173;
+        }
+        return port;
+      })(),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f216c06 and c38bf87.

📒 Files selected for processing (3)
  • apps/frontend/.env.example
  • apps/frontend/electron.vite.config.ts
  • apps/frontend/src/main/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/main/index.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/main/index.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/main/index.ts
  • apps/frontend/electron.vite.config.ts
🧠 Learnings (1)
📚 Learning: 2025-12-30T16:38:36.276Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.276Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`

Applied to files:

  • apps/frontend/.env.example

Comment on lines +46 to +50
# Vite dev server port (default: 5173)
# VITE_DEV_PORT=5173

# Auto-open Chrome DevTools in dev mode (default: true)
# OPEN_DEVTOOLS=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Documentation is clear and matches implementation.

The environment variable documentation accurately describes the defaults and usage. The examples correctly show how to configure the dev server port and disable DevTools.

Optional enhancement: Consider adding a note that OPEN_DEVTOOLS is case-sensitive (only lowercase 'false' disables DevTools):

 # Auto-open Chrome DevTools in dev mode (default: true)
+# Note: Must be exactly 'false' (lowercase) to disable
 # OPEN_DEVTOOLS=false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Vite dev server port (default: 5173)
# VITE_DEV_PORT=5173
# Auto-open Chrome DevTools in dev mode (default: true)
# OPEN_DEVTOOLS=false
# Vite dev server port (default: 5173)
# VITE_DEV_PORT=5173
# Auto-open Chrome DevTools in dev mode (default: true)
# Note: Must be exactly 'false' (lowercase) to disable
# OPEN_DEVTOOLS=false
🤖 Prompt for AI Agents
In apps/frontend/.env.example around lines 46 to 50, add a short note that the
OPEN_DEVTOOLS value is case-sensitive and only the lowercase string 'false' will
disable DevTools; update the comment above the example to explicitly mention
this behavior so users know to use exactly "false" (lowercase) rather than
"False" or "FALSE".


// Open DevTools in development
if (is.dev) {
if (is.dev && process.env.OPEN_DEVTOOLS !== 'false') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider case-insensitive and additional falsy value support.

The current check process.env.OPEN_DEVTOOLS !== 'false' is case-sensitive and only recognizes the exact string 'false'. Common variations like 'False', 'FALSE', '0', or 'no' will still open DevTools, which may be unexpected.

🔎 Optional improvement for more flexible handling
-  if (is.dev && process.env.OPEN_DEVTOOLS !== 'false') {
+  if (is.dev && !['false', '0', 'no'].includes(process.env.OPEN_DEVTOOLS?.toLowerCase() ?? '')) {
     mainWindow.webContents.openDevTools({ mode: 'right' });
   }

This handles false, False, FALSE, 0, no, No, NO as falsy values.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (is.dev && process.env.OPEN_DEVTOOLS !== 'false') {
if (is.dev && !['false', '0', 'no'].includes(process.env.OPEN_DEVTOOLS?.toLowerCase() ?? '')) {
🤖 Prompt for AI Agents
In apps/frontend/src/main/index.ts at line 96, the environment check
process.env.OPEN_DEVTOOLS !== 'false' is case-sensitive and only treats the
exact string 'false' as falsy; update it to normalize the env value (e.g.,
toLowerCase and trim) and compare against a set of falsy tokens like 'false',
'0', 'no', '' (or undefined) so values such as 'False', 'FALSE', '0', or 'no'
are treated as falsy; implement by reading the env into a variable, normalizing,
and checking membership in a predefined falsy array before deciding to open
DevTools.

@steven-pribilinskiy steven-pribilinskiy force-pushed the feat/configurable-devtools-and-port branch from 5a6cdc5 to 313baed Compare December 31, 2025 13:29
@AlexMadera AlexMadera self-assigned this Dec 31, 2025
Copy link
Owner

@AndyMik90 AndyMik90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Auto Claude PR Review

Merge Verdict: 🟠 NEEDS REVISION

1 issue(s) must be addressed (1 required, 0 recommended)

Risk Assessment

Factor Level Notes
Complexity Low Based on lines changed
Security Impact None Based on security findings
Scope Coherence Good Based on structural review

Findings Summary

  • High: 1 issue(s)
  • Low: 4 issue(s)

Generated by Auto Claude PR Review

Findings (5 selected of 5 total)

🟠 [HIGH] dotenv imported but not declared in package.json

📁 apps/frontend/electron.vite.config.ts:4

The PR imports { config } from 'dotenv' but dotenv is not listed in package.json dependencies or devDependencies. It only exists as a transitive dependency (via electron-vite). Importing transitive dependencies directly is fragile - they can disappear when parent packages update. Additionally, Vite/electron-vite already handles .env file loading automatically via Vite's built-in env support, making this import potentially unnecessary.

Suggested fix:

Option 1: Remove the dotenv import entirely - Vite automatically loads .env files and variables prefixed with VITE_ are available via process.env. Option 2: If dotenv is truly needed, add it to devDependencies: `npm install --save-dev dotenv`

🔵 [LOW] Case-sensitive OPEN_DEVTOOLS comparison

📁 apps/frontend/src/main/index.ts:96

The check process.env.OPEN_DEVTOOLS !== 'false' is case-sensitive, so 'FALSE', 'False', or 'NO' would not disable DevTools. This differs from common conventions where boolean environment variables are often case-insensitive.

Suggested fix:

Consider using case-insensitive comparison: `process.env.OPEN_DEVTOOLS?.toLowerCase() !== 'false'`

🔵 [LOW] Inconsistent boolean env var pattern

📁 apps/frontend/src/main/index.ts:96

The proposed !== 'false' pattern differs from the established codebase pattern. Other boolean env vars in this file use === 'true' pattern (e.g., DEBUG, DEBUG_UPDATER). The current approach is actually more user-friendly (opt-out vs opt-in) but deviates from project conventions.

Suggested fix:

Document the intentional difference in .env.example, or for consistency use: `process.env.SKIP_DEVTOOLS !== 'true'` with inverted naming

🔵 [LOW] AI false positive: parseInt radix concern does not apply

📁 apps/frontend/electron.vite.config.ts:62

CodeRabbit flagged 'Add radix parameter to parseInt' as critical, but the code uses Number() not parseInt(). The Number() function doesn't take a radix parameter. This AI comment should be dismissed.

Suggested fix:

Dismiss this AI comment - it misread the code. Number(x) || fallback is the correct pattern used.

🔵 [LOW] AI false positive: Non-numeric string parsing concern

📁 apps/frontend/electron.vite.config.ts:62

Gemini flagged port parsing issues with non-numeric strings as high priority, but this is a false positive. Number('abc') returns NaN, and NaN || 5173 correctly falls back to the default. The pattern handles invalid input safely.

Suggested fix:

Dismiss this AI comment - the Number() || fallback pattern correctly handles non-numeric strings.

This review was generated by Auto Claude.

@steven-pribilinskiy
Copy link
Author

"Does Vite automatically load .env files for use in vite.config.ts? Can you use process.env in the config file without manual dotenv loading?"

According to the electron-vite and Vite documentation.

Tool Call: Fetch https://electron-vite.org/guide/env-and-mode

electron-vite Environment Variable Handling

Based on the documentation, yes, electron-vite automatically loads .env files from the project root, similar to Vite's behavior.

Key Mechanisms:

Prefix-based Scoping: electron-vite uses different prefixes to control where variables are accessible:

  • "MAIN_VITE_" → main process only
  • "PRELOAD_VITE_" → preload scripts only
  • "RENDERER_VITE_" → renderers only
  • "VITE_" → all contexts

Variables without these prefixes aren't exposed to any process.

Customization: You can modify the default prefix through the envPrefix option in your electron.vite.config.js file.

Config vs. Runtime Access:

The documentation indicates that environment variables are accessed at runtime through import.meta.env. For TypeScript projects, you should define type interfaces in env.d.ts to get proper intellisense and type checking when accessing these variables in your code.

The configuration file itself uses these same environment variables through the standard access pattern, making the handling consistent across your build process.

Tool Call: Fetch https://vite.dev/guide/env-and-mode.html

Based on the documentation provided, Vite does not automatically load .env files for use in vite.config.ts.

The documentation explicitly states: "It also allows you to read process.env.NODE_ENV in your Vite config as Vite can only load the env files once the config is evaluated."

This clarifies that environment variables from .env files become available only after the configuration is processed. To use environment variables in your config file, you would need to manually load them using a package like dotenv before your configuration runs, rather than relying on Vite's automatic loading mechanism.

The automatic .env file loading applies to your source code through import.meta.env, not to the configuration file itself.

Assistant

The Vite documentation confirms it: Vite does NOT automatically load .env files for use in vite.config.ts. The .env loading happens after the config is evaluated, so process.env in the config file won't have access to .env variables without manual dotenv loading.

So the dotenv import is necessary and the comment about it being "potentially unnecessary" is incorrect. Our implementation is correct.

@MikeeBuilds MikeeBuilds added feature New feature or request area/frontend This is frontend only size/M Medium (100-499 lines) labels Dec 31, 2025
@steven-pribilinskiy
Copy link
Author

@AndyMik90 something is wrong with the CLA Assistant check, I've already wrote "I have read the CLA Document and I hereby sign the CLA"

@steven-pribilinskiy
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

- Add VITE_DEV_PORT env var to customize Vite dev server port
- Add OPEN_DEVTOOLS env var to control auto-opening DevTools in dev mode
- Document both variables in .env.example
- Load dotenv in electron.vite.config.ts for env var support
@steven-pribilinskiy steven-pribilinskiy force-pushed the feat/configurable-devtools-and-port branch from 313baed to eaa6b1d Compare January 1, 2026 15:25
@steven-pribilinskiy
Copy link
Author

It is a bit pathetic that for a trivial change you have to run

  • CodeRabbit
  • Gemini CLI
  • Claude Code

I would suggest to add a high-level PR agent reviewer that can decide whether an army of AI LLM reviewers is even necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend This is frontend only feature New feature or request size/M Medium (100-499 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants