Is there any possible to add a config file for Vue project to config API URL?
Now I have a Vue web project, and a .Net Web API project.
I have to build the web project every time that I have to publish to different environment.
Is there any possible to add a config file like web.config for .Net Web API that I can edit it any time I want?
What I expected is, I can have a file to edit anytime I want after run command 'npm run build'. Is this possible
It's simple just create file vue. config. js in ROOT folder of project.
Open in browser To view the project, open a tab and type http://localhost:3000 into the URL bar. That's the address that the Node server is listening to. You should now see this page, which is the basic structure of our project.
yes you can add config file if you use webpack
/config/prod.env.js
module.exports = {
NODE_ENV: '"production"', // or development
BASE_URL: '"https://BASEURL/"',
API_URL: '"https://APIURL/"',
}
Assig in build file and use
process.env.API_URL
reference : https://alligator.io/vuejs/working-with-environment-variables/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With