vue-land/create-vue-app

How to pass env variables to vue application?

MykytaLiashenko opened this issue · 4 comments

Hi. I need to pass api url to vue application for vue-resource .
I tried --env.VARIABLE_NAME xxx and VARIABLE_NAME=xxx yarn dev but nothing works.

Just tested it, vbuild --env.VARIABLE_NAME xxx should work.

What about yarn dev command?

You need to update npm scripts in package.json.

Or yarn dev -- [extra arguments] like yarn dev -- --env.VARIABLE_NAME xxx for temporary use.

yarn dev -- [extra arguments] is the best solution.
Thanks.