Static folder without compiling on Vue-cli and being able to change its values menualmente after published

Asked

Viewed 33 times

0

I have a site in vueJS that I publish in every client of mine. this site consumes endpoints. For client A I have www.clienteA.com.br/endpoint/api For client B I have www.clienteB.com.br/endpoint/api What I did didn’t work out:

  1. JSON file

I created a JSON file in the Static directory that has { endpoint: ""}

  1. HTTP service in my serviceshttp I read this json to get the correct url.

  2. Build site give a build on the site The build is via du Vue-cli

  3. Changing Json after published take the Static folder and change the url for each client initially in the same hand.

Error

By what I see I give a build it takes the values of this JSON and injects in my code so do not postpone after the build I change the value.

Is there any way I can do this?

  • Is it just the URL that changes? I would do using environment variables, you would have a .env.clientea a .env.clienteb with the respective urls of each client, take a look at https://cli.vuejs.org/guide/mode-and-env.html#modes

  • but I would have to compile every single change. The idea was to leave it in a json and I would take the post and just swap the json content. all I realized when I do this is that the json is being compiled together and I didn’t want to, my idea was to read the json while using the site

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.