Skip to content

Commit e105e85

Browse files
authored
docs: add note that bun's env loading behavior interferes with Vite's one (vitejs#2193)
1 parent 9f7eaa7 commit e105e85

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

guide/env-and-mode.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ Vite は特定のモードの `.env.[mode]` ファイルに加えて、常に `.
7474
7575
:::
7676
77+
:::warning Bun ユーザー
78+
79+
[Bun](https://bun.sh) を使用する際、Bun はスクリプトの実行前に `.env` ファイルを自動的に読み込むことに注意してください。この組み込み動作により、環境変数が直接 `process.env` に読み込まれ、既存の `process.env` の値を尊重する Vite の機能に干渉する可能性があります。回避策については [oven-sh/bun#5515](https://github.com/oven-sh/bun/issues/5515) を参照してください。
80+
81+
:::
82+
7783
また、Vite は [dotenv-expand](https://github.com/motdotla/dotenv-expand) を使って、設定不要で env ファイルに書かれた変数を展開できます。構文の詳細については、[ドキュメント](https://github.com/motdotla/dotenv-expand#what-rules-does-the-expansion-engine-follow)を参照してください。
7884
7985
環境値の中で `$` を使用する場合は、`\` でエスケープする必要があることに注意してください。

0 commit comments

Comments
 (0)