// 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/admin': {
        target: 'http://192.168.134.6:11000/framework',
        pathRewrite: {
          '/api/admin': '',
        },
        cookiePathRewrite: {
          '/framework/': '/api/',
        },
        changeOrigin: false,
      },
    },
  },
}
