admin管理员组文章数量:1313121
For a typescript library added to a Nx monorepo without build configuration (Vite):
.env file is created in the root of the project: redux
Accessing using dotenv: config.ts
import * as dotenv from 'dotenv';
dotenv.config();
export const APP_SECRET_KEY = process.env.APP_SECRET_KEY || '';
export const DATABASE_URL = process.env.DATABASE_URL || '';
The exported components from this library are used in a app (React+Vite)
Browser is giving the error
Nx docs have given instructions for using environment variables for node and Vite configured apps/libs.
PS: No need of adding Vite for the existing lib as it's not a react component library
本文标签: viteHow to use environment variables in a typescript library with NXStack Overflow
版权声明:本文标题:vite - How to use environment variables in a typescript library with NX - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741926396a2405314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论