Archives_Vue/vue.config.js
2025-07-31 11:14:28 +08:00

58 lines
1.7 KiB
JavaScript
Raw 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.

// 引入等比适配插件
const px2rem = require('postcss-px2rem')
// 配置基本大小
const postcss = px2rem({
// 基准大小 baseSize需要和rem.js中相同
remUnit: 16
})
module.exports = {
// publicPath: process.env.NODE_ENV == "production" ? "./" : "./",
publicPath: './',
devServer: {
historyApiFallback: true,
noInfo: true,
proxy: {
'/api': {
// 是否允许跨域
changeOrigin: true,
// target: 'http://192.168.31.65:8022/',
// target: 'http://192.168.0.109:8002/',
// target: 'http://192.168.1.101:8008/',
// target: 'http://180.76.188.13:8250/',
// target: 'http://192.168.1.118:8022/',
// target: 'http://127.0.0.1:8022/',
target: 'http://champion.natapp1.cc',
secure: false, // 如果目标是 HTTP关闭 HTTPS 验证
ws: true,
pathRewrite: {
'^/api': ''
}
},
}
},
// 使用等比适配插件
lintOnSave: true,
css: {
loaderOptions: {
postcss: {
plugins: [
postcss
]
}
}
},
// 第三方插件配置
pluginOptions: {
// 导入全局的less变量
'style-resources-loader': {
preProcessor: 'less',
//在assets静态资源文件夹下创建全局样式文件index.less 它就是less全局变量
patterns: [require('path').resolve('./src/assets/style/index.less')]
}
},
}