vue-learning/企业级管理系统/web/admin_system/vue.config.js

51 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-12-22 16:10:01 +00:00
/*
* @Author: Kane
* @Date: 2022-12-17 11:08:18
* @LastEditors: Kane
2023-01-07 07:03:51 +00:00
* @LastEditTime: 2023-01-07 12:08:14
2022-12-22 16:10:01 +00:00
* @FilePath: \admin_system\vue.config.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
2023-01-07 07:03:51 +00:00
// 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) =>
2022-12-22 16:10:01 +00:00
{
2023-01-07 07:03:51 +00:00
// 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)
},
};