const path = require('path');
const mobileSrc = path.resolve(__dirname, '../web-mobile/src');

module.exports = {
  publicPath: process.env.NODE_ENV === 'development' ? './' : process.env.VUE_APP_ROUTER,
  pages: {
    index: 'src/pages/corp/main.js',
  },
  configureWebpack: config => {
    Object.assign(config, {
      // 开发生产共同配置
      resolve: {
        alias: {
          '@': path.resolve(__dirname, './src'),
          '@c': path.resolve(__dirname, './src/components'),
          '@a': path.resolve(__dirname, './src/assets'),
          '@m': mobileSrc,
        },
      },
    });
  },
  // css: {
  //   loaderOptions: {
  //     css: {
  //       data: `@import "./src/style/nutui.css";@import "@nutui/nutui/dist/styles/index.css";`,
  //     },
  //   },
  // },
  devServer: {
    port: '8006',
    //api地址前缀
    proxy: {
      '/api': {
        target: 'http://smart.cc-lotus.info',
        changeOrigin: true,
        ws: true,
      },
      '/wxtoken': {
        target: 'http://smart.cc-lotus.info/weixin',
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/wxtoken': 'http://localhost:8005',
        },
      },
      '/files': {
        target: 'http://smart.cc-lotus.info',
        changeOrigin: true,
        ws: true,
      },
    },
  },
};