const path = require('path')
const defaultSettings = require('./src/')
function resolve(dir) {
return (__dirname, dir)
}
const name = // 网址标题
const port = 8099 // 端口配置
= {
// 配置基地址BASE_URL等于publicpath的值
// NODE_ENV: 暴露给执行脚本的系统环境变量。通常用于确定在开发环境还是生产环境
// 部署应用时的根路径(默认'/'),也可用相对路径(存在使用限制)
publicPath: .NODE_ENV === 'development' ? '/' : './',
// publicPath: .NODE_ENV === "production" ? "./" : "./",
outputDir: 'dist', // 输出文件目录
assetsDir: 'static', // // 放置静态资源
lintOnSave: .NODE_ENV === 'development',// true/false 设置为开发环境下每次保存代码时都启用 eslint验证
productionSourceMap: false, // 如果你不需要生产环境的 source map,可以将其设置为false以加速生产环境构建
devServer: { // 配置开发服务器
port: port,
// overlay: { // 错误、警告在页面弹出
// warnings: false,
// errors: true
// },
/* 跨域代理 */
proxy: {
// 第一种写法
'/api': {
/* 目标代理服务器地址 */
target: 'http://localhost:8090/',
/* 允许跨域 */
changeOrigin: true,
pathRewrite: { // 标识替换
'^/api': '/static/mock' // 请求数据路径别名,这里是注意将static/mock放入public文件夹
}
},
// 第二种写法
[.VUE_APP_BASE_API]: { // 使用环境变量中的值
target: 'http://127.0.0.1:9000/',
changeOrigin: true,
pathRewrite: {
['^' + .VUE_APP_BASE_API]: '',
'^/api': ''
}
}
}
}
}