now there is a project packaged when the address of the static resource is written on the dead line, so the static resource cannot be accessed during the test environment.
so you want to control the address when packaging through the command line, such as npm run build-- env=box1
, and then get the passed env parameter
const args = process.argv.splice(2);
let env = ""
args.map(item=>{
let params = item.split("=");
if(params[0] == "env") {
env = params[1]
}
})
module.exports = {
DEV: "dev",
PRODUCT: "product",
SERVER_URL: `https://static${env ? "-" + env: ""}.xxxx.com/xxx/`//
}
as a result, there is no env=box1, in the args that I want, so I have to manually add the env to the cli every time I pack it, but it"s easy to forget
so is there any way to get the parameter env=box1
?
`npm run build --env=box1`
`npm run build --env=box2`
...
`npm run build --env=qc1`
`npm run build --env=qc2`
...