【新增】svg图标

This commit is contained in:
zhoulingpo
2023-05-08 14:35:19 +08:00
parent e116b5dd18
commit 7e6140a4e9
3 changed files with 151 additions and 8 deletions
+22 -3
View File
@@ -1,6 +1,9 @@
const webpack = require('webpack')
const path = require('path')
function resolve (dir) {
return path.join(__dirname, dir)
}
module.exports = {
lintOnSave: false,
// publicPath: '/mi',
outputDir: 'dist', // 运行时生成的生产环境构建文件的目录(默认''dist'',构建之前会被清除)
assetsDir: 'static', // 放置生成的静态资源(s、css、img、fonts)的(相对于 outputDir 的)目录(默认'')
@@ -18,13 +21,28 @@ module.exports = {
},
// 请求静态图片配置项
'/api/home/pic': {
target: 'http://localhost:7061', // 图片请求的nginx网址
target: 'http://10.94.1.164:7061', // 图片请求的nginx网址
changeOrigin: true
}
}
},
chainWebpack: config => {
config.module
.rule('svg')
.exclude.add(resolve('src/icon'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icon'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config.plugin('html').tap(args => {
args[0].title = '大众'
return args
@@ -50,5 +68,6 @@ module.exports = {
// Enumerable: "linq"
})
]
}
},
}