const dotenv = require('dotenv');

// // Load environment variables from .env file
dotenv.config();

module.exports = {
  chainWebpack: (config) => {
    config.plugin('define').tap((definitions) => {
      console.log('VUE_APP_UPGRADE_NAME',JSON.stringify(process.env.VUE_APP_UPGRADE_NAME))
      console.log('VUE_APP_PRODUCTION_API_URL',JSON.stringify(process.env.VUE_APP_PRODUCTION_API_URL))
      console.log('VUE_APP_DEV_API_URL',JSON.stringify(process.env.VUE_APP_DEV_API_URL))
      console.log('VUE_APP_ENV_NAME',JSON.stringify(process.env.VUE_APP_ENV_NAME))
      Object.assign(definitions[0], {
        'process.env': {
          ...definitions[0]['process.env'],
          VUE_APP_UPGRADE_NAME: JSON.stringify(process.env.VUE_APP_UPGRADE_NAME),
          VUE_APP_PRODUCTION_API_URL: JSON.stringify(process.env.VUE_APP_PRODUCTION_API_URL),
          VUE_APP_DEV_API_URL: JSON.stringify(process.env.VUE_APP_DEV_API_URL),
          VUE_APP_ENV_NAME: JSON.stringify(process.env.VUE_APP_ENV_NAME),
        }
      })
      return definitions
    })
  },
  devServer: {
    proxy: {
      '/hcscm': {
        target: 'http://192.168.1.66:50002',
        changeOrigin: true,
        secure: false
      }
    }
  }
}
