You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
429 B
23 lines
429 B
3 years ago
|
const prefixRE = /^VUE_APP_/
|
||
|
|
||
|
module.exports = function resolveClientEnv (options, raw) {
|
||
|
const env = {}
|
||
|
Object.keys(process.env).forEach(key => {
|
||
|
if (prefixRE.test(key) || key === 'NODE_ENV') {
|
||
|
env[key] = process.env[key]
|
||
|
}
|
||
|
})
|
||
|
env.BASE_URL = options.publicPath
|
||
|
|
||
|
if (raw) {
|
||
|
return env
|
||
|
}
|
||
|
|
||
|
for (const key in env) {
|
||
|
env[key] = JSON.stringify(env[key])
|
||
|
}
|
||
|
return {
|
||
|
'process.env': env
|
||
|
}
|
||
|
}
|