resolveClientEnv.js 429 B

12345678910111213141516171819202122
  1. const prefixRE = /^VUE_APP_/
  2. module.exports = function resolveClientEnv (options, raw) {
  3. const env = {}
  4. Object.keys(process.env).forEach(key => {
  5. if (prefixRE.test(key) || key === 'NODE_ENV') {
  6. env[key] = process.env[key]
  7. }
  8. })
  9. env.BASE_URL = options.publicPath
  10. if (raw) {
  11. return env
  12. }
  13. for (const key in env) {
  14. env[key] = JSON.stringify(env[key])
  15. }
  16. return {
  17. 'process.env': env
  18. }
  19. }