Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
ty-vue-ruoyi
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
CI / CD
CI / CD
流水线
日程
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
提交
Open sidebar
刘守彩
ty-vue-ruoyi
Commits
eeb10cd4
提交
eeb10cd4
authored
3月 21, 2024
作者:
刘守彩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize
上级
5947eb9e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
28 行删除
+31
-28
index.js
src/utils/index.js
+1
-3
vue.config.js
vue.config.js
+30
-25
没有找到文件。
src/utils/index.js
浏览文件 @
eeb10cd4
import
dayjs
from
'dayjs'
;
export
{
debounce
}
from
'lodash-es'
;
export
{
throttle
}
from
'lodash-es'
;
export
{
cloneDeep
}
from
'lodash-es'
;
export
{
debounce
,
throttle
,
cloneDeep
}
from
'lodash-es'
;
export
function
formatDate
(
date
,
fmt
=
'YYYY-MM-DD'
)
{
if
(
!
date
)
{
return
''
;
...
...
vue.config.js
浏览文件 @
eeb10cd4
'use strict'
;
const
path
=
require
(
'path'
);
const
CompressionPlugin
=
require
(
'compression-webpack-plugin'
);
const
name
=
process
.
env
.
VUE_APP_TITLE
||
'管理系统'
;
// 网页标题
const
port
=
8999
;
// 端口
const
proxyServer
=
'http://192.168.100.105:8099'
;
function
resolve
(
dir
)
{
return
path
.
join
(
__dirname
,
dir
);
}
const
CompressionPlugin
=
require
(
'compression-webpack-plugin'
);
const
name
=
process
.
env
.
VUE_APP_TITLE
||
'管理系统'
;
// 网页标题
const
port
=
process
.
env
.
port
||
process
.
env
.
npm_config_port
||
4200
;
// 端口
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
// vue.config.js 配置说明
// 官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
...
...
@@ -18,13 +18,13 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath
:
process
.
env
.
NODE_ENV
===
'production'
?
'./'
:
'./'
,
publicPath
:
isDev
?
'./'
:
'./'
,
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
outputDir
:
'dist'
,
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir
:
'static'
,
// 是否开启eslint保存检测,有效值:ture | false | 'error'
lintOnSave
:
process
.
env
.
NODE_ENV
===
'development'
,
lintOnSave
:
isDev
,
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap
:
false
,
// webpack-dev-server 相关配置
...
...
@@ -39,7 +39,7 @@ module.exports = {
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
process
.
env
.
VUE_APP_BASE_API
]:
{
target
:
`http://192.168.100.105:8099`
,
target
:
proxyServer
,
changeOrigin
:
true
,
pathRewrite
:
{
[
'^'
+
process
.
env
.
VUE_APP_BASE_API
]:
''
...
...
@@ -58,12 +58,17 @@ module.exports = {
},
configureWebpack
:
{
name
:
name
,
devtool
:
isDev
?
'cheap-module-eval-source-map'
:
undefined
,
resolve
:
{
alias
:
{
// fix:webpack下vue2.7.x, el-table渲染空白 https://github.com/ElemeFE/element/issues/21984
vue
$
:
'vue/dist/vue.esm.js'
,
'@'
:
resolve
(
'src'
)
}
alias
:
isDev
?
{
'@'
:
resolve
(
'src'
)
}
:
{
// fix:webpack下vue2.7.x, el-table渲染空白 https://github.com/ElemeFE/element/issues/21984
vue
$
:
'vue/dist/vue.esm.js'
,
'@'
:
resolve
(
'src'
)
}
},
plugins
:
[
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
...
...
@@ -94,7 +99,7 @@ module.exports = {
})
.
end
();
config
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
(
config
)
=>
{
config
.
when
(
!
isDev
,
(
config
)
=>
{
config
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
after
(
'html'
)
...
...
@@ -109,24 +114,24 @@ module.exports = {
config
.
optimization
.
splitChunks
({
chunks
:
'all'
,
cacheGroups
:
{
libs
:
{
name
:
'chunk-libs'
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
10
,
chunks
:
'initial'
// only package third parties that are initially dependent
},
elementUI
:
{
name
:
'
chunk-
elementUI'
,
// split elementUI into a single package
name
:
'elementUI'
,
// split elementUI into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
,
// in order to adapt to cnpm
priority
:
20
// the weight needs to be larger than libs and app or it will be packaged into libs or app
priority
:
35
// the weight needs to be larger than libs and app or it will be packaged into libs or app
},
echarts
:
{
name
:
'
chunk-
echarts'
,
// split echarts into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
echarts
(
.*
)
/
,
// in order to adapt to cnpm
name
:
'echarts'
,
// split echarts into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
(
echarts|zrender
)
(
.*
)
/
,
// in order to adapt to cnpm
priority
:
30
// the weight needs to be larger than libs and app or it will be packaged into libs or app
},
libs
:
{
name
:
'libs'
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
25
,
chunks
:
'initial'
// only package third parties that are initially dependent
},
commons
:
{
name
:
'c
hunk-c
ommons'
,
name
:
'commons'
,
test
:
resolve
(
'src/components'
),
// can customize your rules
minChunks
:
3
,
// minimum common number
priority
:
5
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论