const path = require('path');
module.exports = {
  publicPath: `/${process.env.VUE_APP_ROUTER}`,
  outputDir: process.env.VUE_APP_ROUTER,
  productionSourceMap: false,
  configureWebpack: (config) => {
    Object.assign(config, {
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@c': path.resolve(__dirname, './src/components'),
          '@a': path.resolve(__dirname, './src/assets'),
        },
      },
    });
  },
  devServer: {
    port: '9001',
    proxy: {
      '/ws': {
        target: 'http://broadcast.waityou24.cn', // 127.0.0.1:13003
        ws: true,
      },
      '/files': {
        target: 'http://broadcast.waityou24.cn',
      },
      '/dev/point/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      '/point/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      // 团购
      '/point/group/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      '/dev/point/group/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      // 聊天
      '/point/chat/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      '/dev/point/chat/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
      },
      // 尊荣
      '/dev/point/zr/v1/api': {
        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
        changeOrigin: true,
        ws: false,
        // pathRewrite: {
        //   '^/dev/point/zr/v1/api': '/point/zr/v1/api',
        // },
      },
    },
  },
};
