// vue.config.js
let externals
if (process.env.NODE_ENV === 'production') {
  externals = {
    'view-design': 'iview',
    axios: 'axios',
    lodash: '_',
    '@centit/api-admin': 'apiAdmin',
    '@centit/api-auth': 'apiAuth',
    '@centit/ui-layout': 'uiLayout',
    '@centit/ui-form': 'ui-form',
  }
}

module.exports = {
  configureWebpack: {
    externals,
  },
  devServer: {
    disableHostCheck: true,
    proxy: {
      // '/api': {
      //   target: 'http://ceshi.centit.com/framework',
      //   pathRewrite: {
      //     '/api/admin': '',
      //   },
      //   cookiePathRewrite: {
      //     '/framework/': '/api/',
      //   },
      //   changeOrigin: false,
      // },
      '/api/admin': {
        target: 'http://192.168.137.49:8079/framework ',
        pathRewrite: {
          '/api/admin': '',
        },
        cookiePathRewrite: {
          '/framework/': '/api/',
        },
        changeOrigin: false,
      },
    },
  },
}
