mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-24 09:16:53 +00:00
Migrate docs to language-prefixed app routes and split content into zh/en trees, including translated English navigation and pages. Made-with: Cursor
13 lines
529 B
Plaintext
13 lines
529 B
Plaintext
---
|
|
title: 环境变量
|
|
description: Vite 环境变量与 import.meta.env
|
|
---
|
|
|
|
# 环境变量
|
|
|
|
模板使用 **Vite**,请在 `.env`、`.env.development`、`.env.production` 等文件中定义变量,且 **客户端可访问的变量必须以 `VITE_` 前缀** 暴露。
|
|
|
|
在代码中通过 **`import.meta.env.VITE_*`** 读取。API 基地址等常量见各应用 **`src/utils/constants.ts`** 及 README。
|
|
|
|
不要把密钥写入前端可见的 `VITE_` 变量;敏感逻辑放在后端或构建时注入的服务端配置中。
|