const path = require('path')
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, '.', dir)
|
|
}
|
|
module.exports = {
|
|
chainWebpack: config => {
|
|
config.module.rules.delete("svg"); //重点:删除默认配置中处理svg,
|
|
config.module
|
|
.rule('svg-sprite-loader')
|
|
.test(/\.svg$/)
|
|
.include
|
|
.add(resolve('src/icons')) //处理svg目录(根据你建的文件路径)
|
|
.end()
|
|
.use('svg-sprite-loader')
|
|
.loader('svg-sprite-loader')
|
|
.options({
|
|
symbolId: 'icon-[name]'
|
|
})
|
|
},
|
|
// 基本路径
|
|
publicPath: "./",
|
|
// 构建输出目录
|
|
outputDir: "dist",
|
|
// 静态文件
|
|
assetsDir: "static",
|
|
// html路径
|
|
indexPath: "index.html",
|
|
// 文件名哈希
|
|
filenameHashing: true,
|
|
lintOnSave: false,
|
|
// 请求配置
|
|
devServer: {
|
|
//自动打开浏览器
|
|
port: "8080",
|
|
host: "localhost",
|
|
open: true,
|
|
proxy: {
|
|
"/user": {
|
|
target: process.env.VUE_APP_BASE_URL || "http://101.201.121.115:8098/", //要跨域的域名 目标地址
|
|
changeOrigin: true, //是否开启跨域 是否更改源路径
|
|
ws: true,
|
|
pathRewrite: {
|
|
"^/user": "", // /api/ / 凡是/api开头的地址都可以跨域
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|