SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.45k stars 1.54k forks source link

How to use process.env in the render #1106

Open anson2004 opened 2 years ago

anson2004 commented 2 years ago

Hello,

I have separated staging and production environments so I define custom system env for our electron-vue application.

And I create a build script in package.json and try to use cross-env to specify the custom system env value.

Here is a example in package.json "build-prod": "cross-env API_URL=abc.com AUTH_URL=auth.io node .electron-vue/build.js && electron-builder",

But after I run "npm run build" and install it, these system env is not set up in vue application.

Could I ask is there a better way to set up system env in vue application so I can use "process.env" in the vue code and get correct value?

Br, Yiqing