Package Exports
- vite-plugin-env-compatible
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-env-compatible) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@nibfe/vite-plugin-env-compatible
为 Vite 项目增加类似 Vue CLI 的环境变量注入模式
用法
- 执行
yarn add @nibfe/vite-plugin-env-compatible
技术选型
- dotenv & dotenv-expand
说明
vite官方的环境变量相关功能其实已经基于dotenv&dotenv-expand做了,但是默认仅将VITE_开头的环境变量注入 client 代码,且采用最新的 es module 的import.meta.env来挂载- 本插件支持设置要注入的环境变量前缀(默认
VUE_APP_来兼容 vue-cli,用户可以设置为任意的,例如REACT_APP_等),且注入到process.env上