Skip to content

fix(vite-build): env file is supported in vite build#112

Open
ly5156 wants to merge 1 commit into
Project-HAMi:mainfrom
ly5156:fix-env-vite-build
Open

fix(vite-build): env file is supported in vite build#112
ly5156 wants to merge 1 commit into
Project-HAMi:mainfrom
ly5156:fix-env-vite-build

Conversation

@ly5156

@ly5156 ly5156 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor
  1. 修改 .env.production 文件,支持使用 Vite 构建时,符合 Vite 环境变量定义规则,参考:https://v5.vite.dev/guide/env-and-mode.html#env-files
  2. 修改 packages/web/src/utils/request.js 文件,支持使用 Vite 构建时,读取对应的环境变量

Summary by CodeRabbit

  • Bug Fixes
    • Improved API configuration handling for modern builds.
    • Preserved the default 60-second request timeout while supporting updated environment settings.
    • Ensured requests consistently use the configured application API base URL.

@hami-robot

hami-robot Bot commented Jul 15, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ly5156

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot Bot added the size/XS label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ly5156, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d2bcaf2-4cff-4cdd-991b-226bcdcd5601

📥 Commits

Reviewing files that changed from the base of the PR and between dbd29d0 and 618265d.

📒 Files selected for processing (2)
  • packages/web/.env.production
  • packages/web/src/utils/request.js
📝 Walkthrough

Walkthrough

Production API configuration now defines Vite-prefixed base URL and timeout variables. Axios reads these variables first and falls back to the existing process environment variables and defaults.

Changes

Vite API Configuration

Layer / File(s) Summary
Environment configuration and Axios integration
packages/web/.env.production, packages/web/src/utils/request.js
Production settings add VITE_APP_BASE_API and rename the timeout variable to VITE_APP_REQUEST_TIMEOUT; Axios prefers these Vite variables while preserving legacy fallbacks and defaults.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with a Vite-lit tray,
Carrying API paths the modern way.
Timeout tucked at sixty thousand beats,
Fallback carrots make old paths complete.
Hop, hop—requests now know where to go!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the main change: supporting Vite environment variables during the build.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/web/.env.production`:
- Around line 6-10: Rename the production build-time variables to use only the
VITE_APP_* names so API and timeout overrides are recognized. In
packages/web/.env.production lines 6-10, remove the VUE_APP_* variants and
retain the VITE_APP_* variables; in packages/web/src/utils/request.js lines
12-15, no direct change is needed if the existing VITE_APP_* precedence remains
intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e3b66ba-7c36-410c-9fd5-3fb6ecc0a102

📥 Commits

Reviewing files that changed from the base of the PR and between c59f776 and dbd29d0.

📒 Files selected for processing (2)
  • packages/web/.env.production
  • packages/web/src/utils/request.js

Comment thread packages/web/.env.production
Signed-off-by: ly5156 <361112237@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant