beginner vue, builds a project out of scaffolding and adds a "API_ROOT" to "dev.env.js". The code is as follows
"use strict"
const merge = require("webpack-merge")
const prodEnv = require("./prod.env")
module.exports = merge(prodEnv, {
NODE_ENV: ""development"",
API_ROOT:""http://xxx.xxx.xxx""
});
then create an api.js under the src folder
var app = process.env.API_ROOT;
then the index.js in the config folder refers to api.js as the proxy. If you write the dead path in api.js, you can call the interface, but if you use process.env.API_ROOT for interface splicing, it will report a 500error and display
Cannot read property "split" of null
. So I would like to ask whether what is configured in "dev.env.js" can be called globally, and why null