[Question] package.json scripts字段脚本变量在src/browser/app.tsx文件中获取不到值 #2191
Replies: 5 comments
-
electronEnv.env.WORKSPACE 这些变量是来自框架内部的值,不是通过 process.env.WORKSPACE 获取的,如果你需要用可以直接使用 process.env.WORKSPACE 赋值代码 WORKSPACE_DIR |
Beta Was this translation helpful? Give feedback.
-
process.env.WORKSPACE的值 构建后得产物获取不到,但是在start启动阶段可以获取到此值,我想在构建命令里也加入WORKSPACE,并在构建后得产物里使用,是否可行? |
Beta Was this translation helpful? Give feedback.
-
「process.env.WORKSPACE的值 构建后得产物获取不到」 要通过命令行去启动,启动前加上环境变量就行了,比如这样 ABC=testVal /Applications/O2.app/Contents/MacOS/O2 |
Beta Was this translation helpful? Give feedback.
-
好的 我用的child_process.spawn设置的env |
Beta Was this translation helpful? Give feedback.
-
ide-electron项目package.json scripts字段自定义脚本命令加入变量WORKSPACE=E://etest,在src/browser/app.tsx文件中获取不到自定义WORKSPACE变量值, pack命令构建后执行exe,获取不到变量值WORKSPACE,start命令启动获取的到变量值WORKSPACE
Beta Was this translation helpful? Give feedback.
All reactions