Replies: 1 comment
-
import.meta.env 与 process.env 无关, process.env 属于nodejs环境,没有更明确的信息不了解问题所在。请确认是正确使用 |
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.
-
`
export default defineConfig(({ command, mode }) => {
const env = loadEnv('', process.cwd(), ['MYENV'])
for (const key in env) {
console.log(key + '=' + env[key])
process.env[key] = env[key]
}
`
如果我把上面代码中的process.env[key]=env[key]去掉,那么后续组件中无法通过import.meta.env.XXXX取值。
如果不去掉,就能通过import.meta.env.xxxx取值。
像问下,这个是什么原理?
另外,要调试defineConfig方法的话,要怎么调?用的vscdoe开发。
刚学electron,一堆不明白的问题。
Beta Was this translation helpful? Give feedback.
All reactions