|
|
@ -6,72 +6,91 @@ function resolve(dir) { |
|
|
|
return path.join(__dirname, dir) |
|
|
|
} |
|
|
|
|
|
|
|
const name = defaultSettings.title || '工作流' // 标题
|
|
|
|
const name = defaultSettings.title || '汇融云眼贷后监管平台'// page title
|
|
|
|
|
|
|
|
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
|
|
|
// 如果端口设置为80,
|
|
|
|
// 使用管理员权限执行命令行。
|
|
|
|
// 例如,Mac:sudo npm run
|
|
|
|
// 可以通过以下方法更改端口:
|
|
|
|
// port=9528 npm run dev或npm run dev--port=9528
|
|
|
|
const port = process.env.port || process.env.npm_config_port || 9531 // dev port
|
|
|
|
|
|
|
|
// vue.config.js 配置说明
|
|
|
|
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
|
|
|
|
// 这里只列一部分,具体配置参考文档
|
|
|
|
// 所有配置项说明都可以在中找到https://cli.vuejs.org/config/
|
|
|
|
module.exports = { |
|
|
|
// 部署生产环境和开发环境下的URL。
|
|
|
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
|
|
|
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
|
|
|
publicPath: process.env.NODE_ENV === "production" ? "/" : "/", |
|
|
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
|
|
|
outputDir: 'dist', |
|
|
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
|
|
|
/** |
|
|
|
*如果计划在子路径下部署站点,则需要设置publicPath, |
|
|
|
*例如GitHub页面。如果您计划将站点部署到https://foo.github.io/bar/,
|
|
|
|
*然后publicPath应设置为“/bar/”。 |
|
|
|
*在大多数情况下,请使用“/”!!! |
|
|
|
*详细信息:https://cli.vuejs.org/config/#publicpath
|
|
|
|
*/ |
|
|
|
publicPath: process.env.NODE_ENV === 'production' ? '/workflow/' : '/', |
|
|
|
outputDir: 'flowable-ui', |
|
|
|
assetsDir: 'static', |
|
|
|
// 是否开启eslint保存检测,有效值:ture | false | 'error'
|
|
|
|
lintOnSave: process.env.NODE_ENV === 'development', |
|
|
|
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
|
|
|
|
productionSourceMap: false, |
|
|
|
// webpack-dev-server 相关配置
|
|
|
|
devServer: { |
|
|
|
hot: true, // 自动保存
|
|
|
|
host: '0.0.0.0', |
|
|
|
port: port, |
|
|
|
open: true, |
|
|
|
overlay: { |
|
|
|
warnings: false, |
|
|
|
errors: true |
|
|
|
}, |
|
|
|
proxy: { |
|
|
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
|
|
/*[process.env.VUE_APP_BASE_API]: { |
|
|
|
target: `http://localhost:7001`, // 改成自己的接口地址
|
|
|
|
changeOrigin: true, |
|
|
|
pathRewrite: { |
|
|
|
['^' + process.env.VUE_APP_BASE_API]: '' |
|
|
|
} |
|
|
|
}*/ |
|
|
|
'/api': { // 匹配所有以 '/api'开头的请求路径
|
|
|
|
// target: 'http://192.168.1.109:8111',
|
|
|
|
target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
|
|
|
target: "http://jianguan.yyundong.com/", // 代理目标的基础路径
|
|
|
|
changeOrigin: true, // 支持跨域
|
|
|
|
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
|
|
|
'^/api': '' |
|
|
|
} |
|
|
|
}, |
|
|
|
'/upload': { // 匹配所有以 '/api'开头的请求路径
|
|
|
|
// target: 'http://120.46.131.15:8111',
|
|
|
|
target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
|
|
|
changeOrigin: true, // 支持跨域
|
|
|
|
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
|
|
|
'^/upload': '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
disableHostCheck: true |
|
|
|
}, |
|
|
|
configureWebpack: { |
|
|
|
// 在webpack的name字段中提供应用程序的标题,以便
|
|
|
|
// 它可以在索引.html插入正确的标题。
|
|
|
|
name: name, |
|
|
|
resolve: { |
|
|
|
alias: { |
|
|
|
'@': resolve('src') |
|
|
|
'@': resolve('src'), |
|
|
|
'@C': resolve('src/components') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
chainWebpack(config) { |
|
|
|
config.plugins.delete('preload') // TODO: need test
|
|
|
|
config.plugins.delete('prefetch') // TODO: need test
|
|
|
|
// 它可以提高第一屏的速度,建议打开预加载
|
|
|
|
config.plugin('preload').tap(() => [{ |
|
|
|
rel: 'preload', |
|
|
|
// 忽略 runtime.js
|
|
|
|
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
|
|
|
|
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/], |
|
|
|
include: 'initial' |
|
|
|
}]) |
|
|
|
|
|
|
|
// set svg-sprite-loader
|
|
|
|
// 当有很多页面时,会导致太多无意义的请求
|
|
|
|
config.plugins.delete('prefetch') |
|
|
|
|
|
|
|
// set svg-sprite-loader 设置 svg精灵加载程序
|
|
|
|
config.module |
|
|
|
.rule('svg') |
|
|
|
.exclude.add(resolve('src/assets/icons')) |
|
|
|
.exclude.add(resolve('src/icons')) |
|
|
|
.end() |
|
|
|
config.module |
|
|
|
.rule('icons') |
|
|
|
.test(/\.svg$/) |
|
|
|
.include.add(resolve('src/assets/icons')) |
|
|
|
.include.add(resolve('src/icons')) |
|
|
|
.end() |
|
|
|
.use('svg-sprite-loader') |
|
|
|
.loader('svg-sprite-loader') |
|
|
@ -115,11 +134,8 @@ module.exports = { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
config.optimization.runtimeChunk('single'), |
|
|
|
{ |
|
|
|
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
|
|
|
|
to: './', //到根目录下
|
|
|
|
} |
|
|
|
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
|
|
|
|
config.optimization.runtimeChunk('single') |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|