web-infra-dev / rsbuild

The Rspack-based build tool. It's fast, out-of-the-box and extensible.
https://rsbuild.dev/
MIT License
1.86k stars 143 forks source link

[Feature]: specify .env files #4040

Closed MuyianKing closed 3 days ago

MuyianKing commented 3 days ago

What problem does this feature solve?

当存在多环境情况目前无法配置 Image 图上开发环境和生产环境分别有三个配置

What does the proposed API look like?

Image 希望可以对齐vite的启动和打包配置

chenjiahan commented 3 days ago

Rsbuild CLI provides the --env-mode option to specify env file, see: https://rsbuild.dev/guide/advanced/env-vars#env-mode

MuyianKing commented 3 days ago

Rsbuild CLI provides the --env-mode option to specify env file, see: https://rsbuild.dev/guide/advanced/env-vars#env-mode --mode 改为--env-mode就可以了,我是vite切过来的,这里有点不一样