jh-front-end-example-2/vue.config.js

60 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: Billy
* @Date: 2020-06-03 09:47:31
* @LastEditors: Billy
* @LastEditTime: 2022-01-10 13:49:17
* @Description: 请输入
*/
const path = require('path');
function resolve(dir) {
return path.join(__dirname, dir);
}
/**
* @see https://cli.vuejs.org/zh/config/#vue-config-js
*/
module.exports = {
devServer: {
port: 8030,
proxy: {
'/api': {
target: 'http://ty.y68.fun/sales-show-3',
ws: true,
changeOrigin: true, // false请求头中host仍然是浏览器发送过来的hosttrue请求头中host会设置成target
// secure: false, // 如果是https接口需要配置这个参数
pathRewrite: {
'^/api': '', // 重写请求路径
},
}
}
},
/**
* @see https://cli.vuejs.org/zh/config/#publicpath
*/
publicPath: "./",
configureWebpack: {
plugins: []
},
chainWebpack(config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/svgicon'))
.end();
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/svgicon'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]',
})
.end();
},
};