yue1123 / vite-plugin-env-parse

Parse env string values to correct values, not all values are strings. And automatically generate ImportMetaEnv
MIT License
67 stars 4 forks source link

希望可以新增相关参数可以手动指定部分环境变量的类型 #3

Open liub1934 opened 2 months ago

liub1934 commented 2 months ago

Is your feature request related to a problem? Please describe. 项目中会新建.env.test.env.stag.env.prod这几个环境变量文件,用于不用环境打包参数的配置,其中可能会有个环境变量VITE_BUILD_ENV用于指定构建的环境类型,期望VITE_BUILD_ENV的值只可能是'test' | 'stag' | 'prod'

image

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

yue1123 commented 2 months ago

这个涉及到.env文件里面参数的校验了,超出了这个插件的范畴。我建议提前创建好这几个文件,然后在每个env文件里面覆盖VITE_BUILD_ENV,通过 vite --mode [test | stag | prod]来使用指定的环境变量