/*
 * @Author: Kane
 * @Date: 2022-12-17 11:08:18
 * @LastEditors: Kane
 * @LastEditTime: 2023-01-07 12:08:14
 * @FilePath: \admin_system\vue.config.js
 * @Description: 
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
// const { defineConfig } = require('@vue/cli-service');
// module.exports = defineConfig(
//   {
//     transpileDependencies: true,
//     devServer: {
//       open: true,
//       host: "localhost",
//       port: 8000,
//     },
//   }
// );
module.exports = {
  transpileDependencies: true,
  devServer: {
    open: true,
    host: "localhost",
    port: 8000,
  },
  chainWebpack: (config) =>
  {
    // svg 图标解析
    const svgRule = config.module.rule("svg");  //默认规则赋给 subRule 变量  
    svgRule.uses.clear();  // 清除已有的所有规则。
    svgRule  // 添加要替换的规则
      .use("svg-sprite-loader")
      .loader("svg-sprite-loader")
      .options({
        symbolId: "icon-[name]",
        include: ["./src/components/svg/icons"] // 特别注意的目录路径
      });
    // 配置base64转换规则
    // config.module
    //   .rule('images')
    //   .use('url-loader')
    //   .loader('url-loader')
    //   .tap(options => Object.assign(options, { limit: 1 }));

    // 载入项目分析工具
    // config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
  },
};