
/**
 * 配置参考: https://cli.vuejs.org/zh/config/
 */
const timestamp = new Date().getTime();

module.exports = {
  publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
  chainWebpack: (config) => {
    const svgRule = config.module.rule("svg");
    svgRule.uses.clear();
    svgRule
      .test(/\.svg$/)
      .use("svg-sprite-loader")
      .loader("svg-sprite-loader");
  },
  // 默认打开eslint效验，如果需要关闭，设置成false即可
  lintOnSave: false,
  productionSourceMap: false,
  devServer: {
    open: true,
    host: "0.0.0.0",
    port: 8001,
  },
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "production") {
      return {
        output: {
          filename: `[name].[hash].${timestamp}.js`,
          chunkFilename: `[name].[hash].${timestamp}.js`,
        },
        performance: {
          maxEntrypointSize: 10000000,
          maxAssetSize: 30000000,
        },
      };
    }
  },
};
