How I can get environment variable without process.env
, because it is undefined, due to launched app by npm run serve
command.
p.s. My app is single Vue page.
Asked
Active
Viewed 1,434 times
1

Ted
- 1,682
- 3
- 25
- 52
-
question is deleted, created more simple topic. – Ted Jan 10 '19 at 15:11
-
1Are you trying to access `process.env` in Node, or in the browser? If you're trying to do it in the browser, it's not going to work. If you're trying to do it in Node, `process.env` being `undefined` would be very weird, and the question you should be asking is why it's `undefined`. Running `npm run serve` will not cause that, unless the `serve` script is doing something very unusual. – Jordan Running Jan 10 '19 at 15:19
1 Answers
0
place the .env file in your project dir,
inside this file you can write key value variables. Like
SECRET=mySecret
for mor info: vue cli dock

Vladimir Krylov
- 158
- 10
-
"You can access them in your application code: console.log(process.env.VUE_APP_SECRET)" but process.env is undefined in my case – Ted Jan 10 '19 at 15:14