关于前端配置的暴露问题
#6906
Replies: 2 comments 1 reply
-
没能看懂你的代码,希望能给到仓库方便我们理解 |
Beta Was this translation helpful? Give feedback.
1 reply
-
你需要的是这种形式吗:https://rsbuild.rs/zh/guide/advanced/env-vars#public-%E5%8F%98%E9%87%8F |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
我的项目有一些配置希望在 CSR 阶段暴露不同的内容,防止敏感的配置暴露到浏览器端。
当前我的做法是,定义了一个
config/server.ts
文件,读取process.env
环境变量。同时定义一个
config/client.ts
读取process.env
环境变量。然后使用
source.globalVars
暴露到浏览器端。但是这样的代码很不优雅。
演示代码:https://github.com/yuan1238y/config-demo
请问有没有其他更合适的配置管理方案,既可以在服务端(Node.js)使用,又能暴露部分到浏览器端。
Beta Was this translation helpful? Give feedback.
All reactions