const proxy = {
  "/api/uq_basic": {
    target: process.env.VUE_APP_QUESTIONS_HOST_URL,
    changeOrigin: true,
  },
};

var webpack = require("webpack");
/** @type {import("@vue/cli-service").ProjectOptions} */
module.exports = {
  // 这里设置项目的路径,比如 '/admin' 。设置以后 BASE_URL就有值了。
  // 注意这解决不了CDN的问题,CDN的问题要另行研究。
  // 可能的方案是另设一个替代 BASE_URL 的环境变量解决 <%%= BASE_URL %%>favicon.ico 和 ${process.env.BASE_URL}service-worker.js
  publicPath: "/admin",
  lintOnSave: process.env.NODE_ENV !== "production" ? true : "error",
  devServer: {
    proxy,
  },
  configureWebpack: {
    // devtool: "source-map",  // for vscode debug
    plugins: [
      // Ignore all locale files of moment.js
      new webpack.IgnorePlugin({
        resourceRegExp: /^\.\/locale$/,
        contextRegExp: /moment$/,
      }),
      // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
    ],
  },
  transpileDependencies: [/\bvue-awesome\b/],
};

require("events").EventEmitter.defaultMaxListeners = 0;