Answer the question
In order to leave comments, you need to log in
How to organize deployment variables in VueJS?
There is an application that works with the backend via api. In development, the address of the backend is one, and in production it is another.
How to make something like a config file that will not be in the git, in which you can specify your data for each application?
I got into the config folder, there are dev.env.js and prod.env.js files. Wrote there:
module.exports = {
NODE_ENV: '"production"',
API_URL: 'http://mysite.ru'
}
process.env.API_URL
import process from 'process'
ERROR in chunk app [initial]
static/js/[name].[chunkhash].js
Unexpected token (16:71)
Answer the question
In order to leave comments, you need to log in
Get the dotenv package.
In the .env file, you describe the environment variables.
Make a src/config.js file.
This is a module that returns an object with settings, the structure is the same as dev.env.js.
To make application settings available from anywhere, you can package this as a Vue plugin.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question