Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content/docs/zh-cn/guides/deploy/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ Cloudflare 更建议为新项目使用 Cloudflare Workers。对于现有的、

- 这意味着你在服务器端环境中使用的某个包或导入项与 [Cloudflare 运行时 API](https://developers.cloudflare.com/workers/runtime-apis/nodejs/) 不兼容。

- 如果你直接导入了一个 Node.js 运行时 API,请参考 Astro 关于 Cloudflare 的 [Node.js 兼容性](/zh-cn/guides/integrations-guide/cloudflare/#nodejs-compatibility) 文档,了解如何解决这个问题的进一步步骤。
- 如果你直接导入了一个 Node.js 运行时 API,请参考 Astro 关于 Cloudflare 的 [Node.js 兼容性](/zh-cn/guides/integrations-guide/cloudflare/#nodejs-兼容性) 文档,了解如何解决这个问题的进一步步骤。

- 如果你导入的包中包含了 Node.js 运行时 API,请检查该包的作者是否支持 `node:*` 的导入语法。如果不支持,你可能需要找到一个替代的包。
2 changes: 1 addition & 1 deletion src/content/docs/zh-cn/guides/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const data = await db(import.meta.env.DB_PASSWORD);
const data = fetch(`${import.meta.env.PUBLIC_POKEAPI}/pokemon/squirtle`);
```

使用 SSR 时,可以根据所使用的 SSR 适配器,在运行时访问环境变量。对于大部分适配器,可以通过 `process.env` 访问环境变量,但有一些适配器在工作时有所不同。Deno 适配器则需要使用 `Deno.env.get()`。在使用 Cloudflare 适配器时,可以参阅如何 [访问 Cloudflare 运行时](/zh-cn/guides/integrations-guide/cloudflare/#cloudflare-runtime) 以处理环境变量。Astro 会检查服务器环境中的变量,如果这些变量不存在,则会在 `.env` 文件中查找它们。
使用 SSR 时,可以根据所使用的 SSR 适配器,在运行时访问环境变量。对于大部分适配器,可以通过 `process.env` 访问环境变量,但有一些适配器在工作时有所不同。Deno 适配器则需要使用 `Deno.env.get()`。在使用 Cloudflare 适配器时,可以参阅如何 [访问 Cloudflare 运行时](/zh-cn/guides/integrations-guide/cloudflare/#cloudflare-运行时) 以处理环境变量。Astro 会检查服务器环境中的变量,如果这些变量不存在,则会在 `.env` 文件中查找它们。

## 类型安全的环境变量

Expand Down
Loading
Loading