let targetUrl = "https://dev.gym.lexiaoya.cn";
// let targetUrl = "http://192.168.3.26:8000";
// let targetUrl = 'http://192.168.3.20:8000'
// let targetUrl = 'https://online.gym.lexiaoya.cn'
// let targetUrl = 'http://dev.gym.lexiaoya.cn/'
// let targetUrl = 'http://192.168.3.124:8000'
module.exports = {
  publicPath: "./",
  chainWebpack: (config) => {
    config.devtool("inline-source-map");
    config.output.filename("[name].[hash].js").end();
    // // chunkHash
    // config.output.filename(`js/[name].[chunkhash].${Version}.js`).end();
    // config.output.chunkFilename(`js/[id].[chunkhash].${Version}.js`).end();
    // config.output.filename(`js/[name].[chunkhash].js`).end();
    // config.output.chunkFilename(`js/[id].[chunkhash].js`).end();
    // config.entry.app = ['babel-polyfill', './src/main.js']

    // config.resolve.symlinks(true)
    // config.plugin('html').tap(args => {
    //   args[0].chunksSortMode = 'none'
    //   return args
    // })
    config.plugin("html").tap((args) => {
      args[0].minify = {
        removeAttributeQuotes: false,
      };
      return args;
    });
  },
  // eslint-loader 是否在保存的时候检查
  lintOnSave: true,

  // 是否使用包含运行时编译器的Vue核心的构建
  runtimeCompiler: false,
  // 生产环境 sourceMap
  productionSourceMap: false,
  configureWebpack: () => {},
  // 配置 webpack-dev-server 行为。
  devServer: {
    open: process.platform === "darwin",
    host: "0.0.0.0",
    port: 9999,
    // https: true,
    hotOnly: false,
    // 查阅 https://github.com/vuejs/vue-doc-zh-cn/vue-cli/cli-service.md#配置代理
    proxy: {
      "/contracts": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/contracts": "/contracts",
        xfwd: true,
      },
      "/api-student": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-student": "/api-student",
        xfwd: true,
      },
      "/api-cms": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-cms": "/api-cms",
        xfwd: true,
      },
      "/api-teacher": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-teacher": "/api-teacher",
        xfwd: true,
      },
      "/api-web": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-web": "/api-web",
        xfwd: true,
      },
      "/api-auth": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-auth": "/api-auth",
        xfwd: true,
      },
      "/api-mall-portal": {
        target: targetUrl,
        changeOrigin: true,
      },
      "/api-oa": {
        target: targetUrl,
        changeOrigin: true,
        ws: true,
        "^/api-oa": "/api-oa",
        xfwd: true,
      },
    }, // string | Object
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          // red: '#03a9f4',
          blue: "#01C1B5",
          // orange: '#f08d49',
          // 'text-color': '#111'
        },
      },
    },
  },
};
