Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sup-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
sup-server
Commits
c5c14fb7
Commit
c5c14fb7
authored
Oct 10, 2022
by
tianhongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全局环境配置
打包优化配置
parent
48c9d7bb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
313 additions
and
51 deletions
+313
-51
.env.development
dsk-srm-server/.env.development
+5
-0
.env.production
dsk-srm-server/.env.production
+5
-0
babel.config.js
dsk-srm-server/babel.config.js
+9
-2
package-lock.json
dsk-srm-server/package-lock.json
+98
-43
package.json
dsk-srm-server/package.json
+8
-3
HelloWorld.vue
dsk-srm-server/src/components/HelloWorld.vue
+59
-0
permissions.js
dsk-srm-server/src/utils/permissions.js
+0
-0
AboutView.vue
dsk-srm-server/src/views/AboutView.vue
+5
-0
HomeView.vue
dsk-srm-server/src/views/HomeView.vue
+18
-0
vue.config.js
dsk-srm-server/vue.config.js
+106
-3
No files found.
dsk-srm-server/.env.development
0 → 100644
View file @
c5c14fb7
NODE_ENV = "development"
BASE_URL = "/"
VUE_APP_TITLE = "供应商端"
VUE_APP_BASE_API = "/test"
VUE_APP_OUT_PUT_DIR = "test"
\ No newline at end of file
dsk-srm-server/.env.production
0 → 100644
View file @
c5c14fb7
NODE_ENV = "production"
BASE_URL = "/"
VUE_APP_TITLE = "供应商端"
VUE_APP_BASE_API = "/pro"
VUE_APP_OUT_PUT_DIR = "dist"
\ No newline at end of file
dsk-srm-server/babel.config.js
View file @
c5c14fb7
const
IS_PROD
=
[
"production"
,
"prod"
].
includes
(
process
.
env
.
NODE_ENV
);
const
plugins
=
[];
if
(
IS_PROD
)
{
plugins
.
push
(
"transform-remove-console"
);
}
module
.
exports
=
{
presets
:
[
'@vue/cli-plugin-babel/preset'
]
}
],
plugins
};
\ No newline at end of file
dsk-srm-server/package-lock.json
View file @
c5c14fb7
...
...
@@ -1863,49 +1863,6 @@
"webpack-merge"
:
"^5.7.3"
,
"webpack-virtual-modules"
:
"^0.4.2"
,
"whatwg-fetch"
:
"^3.6.2"
},
"dependencies"
:
{
"@vue/vue-loader-v15"
:
{
"version"
:
"npm:vue-loader@15.10.0"
,
"resolved"
:
"https://registry.npmmirror.com/vue-loader/-/vue-loader-15.10.0.tgz"
,
"integrity"
:
"sha512-VU6tuO8eKajrFeBzMssFUP9SvakEeeSi1BxdTH5o3+1yUyrldp8IERkSdXlMI2t4kxF2sqYUDsQY+WJBxzBmZg=="
,
"dev"
:
true
,
"requires"
:
{
"@vue/component-compiler-utils"
:
"^3.1.0"
,
"hash-sum"
:
"^1.0.2"
,
"loader-utils"
:
"^1.1.0"
,
"vue-hot-reload-api"
:
"^2.3.0"
,
"vue-style-loader"
:
"^4.1.0"
},
"dependencies"
:
{
"hash-sum"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz"
,
"integrity"
:
"sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA=="
,
"dev"
:
true
}
}
},
"json5"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmmirror.com/json5/-/json5-1.0.1.tgz"
,
"integrity"
:
"sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow=="
,
"dev"
:
true
,
"requires"
:
{
"minimist"
:
"^1.2.0"
}
},
"loader-utils"
:
{
"version"
:
"1.4.0"
,
"resolved"
:
"https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.0.tgz"
,
"integrity"
:
"sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA=="
,
"dev"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^1.0.1"
}
}
}
},
"@vue/cli-shared-utils"
:
{
...
...
@@ -2055,6 +2012,47 @@
}
}
},
"@vue/vue-loader-v15"
:
{
"version"
:
"npm:vue-loader@15.10.0"
,
"resolved"
:
"https://registry.npmmirror.com/vue-loader/-/vue-loader-15.10.0.tgz"
,
"integrity"
:
"sha512-VU6tuO8eKajrFeBzMssFUP9SvakEeeSi1BxdTH5o3+1yUyrldp8IERkSdXlMI2t4kxF2sqYUDsQY+WJBxzBmZg=="
,
"dev"
:
true
,
"requires"
:
{
"@vue/component-compiler-utils"
:
"^3.1.0"
,
"hash-sum"
:
"^1.0.2"
,
"loader-utils"
:
"^1.1.0"
,
"vue-hot-reload-api"
:
"^2.3.0"
,
"vue-style-loader"
:
"^4.1.0"
},
"dependencies"
:
{
"hash-sum"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz"
,
"integrity"
:
"sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA=="
,
"dev"
:
true
},
"json5"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmmirror.com/json5/-/json5-1.0.1.tgz"
,
"integrity"
:
"sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow=="
,
"dev"
:
true
,
"requires"
:
{
"minimist"
:
"^1.2.0"
}
},
"loader-utils"
:
{
"version"
:
"1.4.0"
,
"resolved"
:
"https://registry.npmmirror.com/loader-utils/-/loader-utils-1.4.0.tgz"
,
"integrity"
:
"sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA=="
,
"dev"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^1.0.1"
}
}
}
},
"@vue/web-component-wrapper"
:
{
"version"
:
"1.3.0"
,
"resolved"
:
"https://registry.npmmirror.com/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz"
,
...
...
@@ -2441,6 +2439,12 @@
"@babel/helper-define-polyfill-provider"
:
"^0.3.3"
}
},
"babel-plugin-transform-remove-console"
:
{
"version"
:
"6.9.4"
,
"resolved"
:
"https://registry.npmmirror.com/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz"
,
"integrity"
:
"sha512-88blrUrMX3SPiGkT1GnvVY8E/7A+k6oj3MNvUtTIxJflFzXTw1bHkuJ/y039ouhFMp2prRn5cQGzokViYi1dsg=="
,
"dev"
:
true
},
"balanced-match"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz"
,
...
...
@@ -2910,6 +2914,57 @@
}
}
},
"compression-webpack-plugin"
:
{
"version"
:
"10.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/compression-webpack-plugin/-/compression-webpack-plugin-10.0.0.tgz"
,
"integrity"
:
"sha512-wLXLIBwpul/ALcm7Aj+69X0pYT3BYt6DdPn3qrgBIh9YejV9Bju9ShhlAsjujLyWMo6SAweFIWaUoFmXZNuNrg=="
,
"dev"
:
true
,
"requires"
:
{
"schema-utils"
:
"^4.0.0"
,
"serialize-javascript"
:
"^6.0.0"
},
"dependencies"
:
{
"ajv"
:
{
"version"
:
"8.11.0"
,
"resolved"
:
"https://registry.npmmirror.com/ajv/-/ajv-8.11.0.tgz"
,
"integrity"
:
"sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg=="
,
"dev"
:
true
,
"requires"
:
{
"fast-deep-equal"
:
"^3.1.1"
,
"json-schema-traverse"
:
"^1.0.0"
,
"require-from-string"
:
"^2.0.2"
,
"uri-js"
:
"^4.2.2"
}
},
"ajv-keywords"
:
{
"version"
:
"5.1.0"
,
"resolved"
:
"https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz"
,
"integrity"
:
"sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw=="
,
"dev"
:
true
,
"requires"
:
{
"fast-deep-equal"
:
"^3.1.3"
}
},
"json-schema-traverse"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz"
,
"integrity"
:
"sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
,
"dev"
:
true
},
"schema-utils"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmmirror.com/schema-utils/-/schema-utils-4.0.0.tgz"
,
"integrity"
:
"sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg=="
,
"dev"
:
true
,
"requires"
:
{
"@types/json-schema"
:
"^7.0.9"
,
"ajv"
:
"^8.8.0"
,
"ajv-formats"
:
"^2.1.1"
,
"ajv-keywords"
:
"^5.0.0"
}
}
}
},
"concat-map"
:
{
"version"
:
"0.0.1"
,
"resolved"
:
"https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz"
,
...
...
dsk-srm-server/package.json
View file @
c5c14fb7
...
...
@@ -3,8 +3,9 @@
"version"
:
"0.1.0"
,
"private"
:
true
,
"scripts"
:
{
"serve"
:
"vue-cli-service serve"
,
"build"
:
"vue-cli-service build"
"test"
:
"vue-cli-service serve --development"
,
"serve"
:
"vue-cli-service serve --production"
,
"build"
:
"vue-cli-service build --production"
},
"dependencies"
:
{
"core-js"
:
"^3.8.3"
,
...
...
@@ -17,9 +18,13 @@
"@vue/cli-plugin-router"
:
"~5.0.0"
,
"@vue/cli-plugin-vuex"
:
"~5.0.0"
,
"@vue/cli-service"
:
"~5.0.0"
,
"babel-plugin-transform-remove-console"
:
"^6.9.4"
,
"compression-webpack-plugin"
:
"^10.0.0"
,
"image-webpack-loader"
:
"^8.1.0"
,
"sass"
:
"^1.32.7"
,
"sass-loader"
:
"^12.0.0"
,
"vue-template-compiler"
:
"^2.6.14"
"vue-template-compiler"
:
"^2.6.14"
,
"webpack-bundle-analyzer"
:
"^4.6.1"
},
"browserslist"
:
[
"> 1%"
,
...
...
dsk-srm-server/src/components/HelloWorld.vue
0 → 100644
View file @
c5c14fb7
<
template
>
<div
class=
"hello"
>
<h1>
{{
msg
}}
</h1>
<p>
For a guide and recipes on how to configure / customize this project,
<br>
check out the
<a
href=
"https://cli.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-cli documentation
</a>
.
</p>
<h3>
Installed CLI Plugins
</h3>
<ul>
<li><a
href=
"https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
target=
"_blank"
rel=
"noopener"
>
babel
</a></li>
<li><a
href=
"https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router"
target=
"_blank"
rel=
"noopener"
>
router
</a></li>
<li><a
href=
"https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex"
target=
"_blank"
rel=
"noopener"
>
vuex
</a></li>
</ul>
<h3>
Essential Links
</h3>
<ul>
<li><a
href=
"https://vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Core Docs
</a></li>
<li><a
href=
"https://forum.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Forum
</a></li>
<li><a
href=
"https://chat.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
Community Chat
</a></li>
<li><a
href=
"https://twitter.com/vuejs"
target=
"_blank"
rel=
"noopener"
>
Twitter
</a></li>
<li><a
href=
"https://news.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
News
</a></li>
</ul>
<h3>
Ecosystem
</h3>
<ul>
<li><a
href=
"https://router.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-router
</a></li>
<li><a
href=
"https://vuex.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vuex
</a></li>
<li><a
href=
"https://github.com/vuejs/vue-devtools#vue-devtools"
target=
"_blank"
rel=
"noopener"
>
vue-devtools
</a></li>
<li><a
href=
"https://vue-loader.vuejs.org"
target=
"_blank"
rel=
"noopener"
>
vue-loader
</a></li>
<li><a
href=
"https://github.com/vuejs/awesome-vue"
target=
"_blank"
rel=
"noopener"
>
awesome-vue
</a></li>
</ul>
</div>
</
template
>
<
script
>
export
default
{
name
:
'HelloWorld'
,
props
:
{
msg
:
String
}
}
</
script
>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<
style
scoped
lang=
"scss"
>
h3
{
margin
:
40px
0
0
;
}
ul
{
list-style-type
:
none
;
padding
:
0
;
}
li
{
display
:
inline-block
;
margin
:
0
10px
;
}
a
{
color
:
#42b983
;
}
</
style
>
dsk-srm-server/src/utils/permissions.js
0 → 100644
View file @
c5c14fb7
dsk-srm-server/src/views/AboutView.vue
0 → 100644
View file @
c5c14fb7
<
template
>
<div
class=
"about"
>
<h1>
This is an about page
</h1>
</div>
</
template
>
dsk-srm-server/src/views/HomeView.vue
0 → 100644
View file @
c5c14fb7
<
template
>
<div
class=
"home"
>
<img
alt=
"Vue logo"
src=
"../assets/logo.png"
>
<HelloWorld
msg=
"Welcome to Your Vue.js App"
/>
</div>
</
template
>
<
script
>
// @ is an alias to /src
import
HelloWorld
from
'@/components/HelloWorld.vue'
export
default
{
name
:
'HomeView'
,
components
:
{
HelloWorld
}
}
</
script
>
dsk-srm-server/vue.config.js
View file @
c5c14fb7
const
{
defineConfig
}
=
require
(
'@vue/cli-service'
)
const
{
defineConfig
}
=
require
(
'@vue/cli-service'
);
// 绝对路径引用
const
path
=
require
(
"path"
);
// 是否生产环境
const
isPro
=
process
.
env
.
NODE_ENV
==
"production"
;
// 打包体积分析
const
BundleAnalyzerPlugin
=
require
(
'webpack-bundle-analyzer'
).
BundleAnalyzerPlugin
;
module
.
exports
=
defineConfig
({
transpileDependencies
:
true
})
transpileDependencies
:
true
,
publicPath
:
process
.
env
.
BASE_URL
,
assetsDir
:
"static"
,
outputDir
:
process
.
env
.
VUE_APP_OUT_PUT_DIR
||
'dist'
,
productionSourceMap
:
isPro
,
configureWebpack
:
config
=>
{
config
.
output
.
path
=
path
.
resolve
(
__dirname
,
process
.
env
.
VUE_APP_OUT_PUT_DIR
);
config
.
output
.
filename
=
"static/js/[name].js"
;
config
.
output
.
chunkFilename
=
"static/js/[name].js"
;
},
chainWebpack
:
config
=>
{
config
.
when
(
isPro
,
_config
=>
{
// 去除浏览器预加载
_config
.
plugins
.
delete
(
'preload'
);
_config
.
plugins
.
delete
(
'prefetch'
);
// 关闭打包超出压缩率警告
_config
.
performance
.
hints
(
false
);
// 压缩文件
_config
.
optimization
.
minimize
(
true
);
// 深度分割
_config
.
optimization
.
splitChunks
({
chunks
:
'async'
,
minSize
:
30000
,
// 允许新拆出 chunk 的最小体积
maxSize
:
0
,
// 旨在与 HTTP/2 和长期缓存一起使用。它增加了请求数量以实现更好的缓存。它还可以用于减小文件大小,以加快二次构建速度。
minChunks
:
1
,
// 拆分前被 chunk 公用的最小次数
maxAsyncRequests
:
5
,
// 每个异步加载模块最多能被拆分的数量
maxInitialRequests
:
3
,
// 每个入口和它的同步依赖最多能被拆分的数量
automaticNameDelimiter
:
'~'
,
cacheGroups
:
{
libs
:
{
name
:
'main-chunk`'
,
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
-
10
,
chunks
:
'all'
},
elementUI
:
{
name
:
'element-ui'
,
priority
:
0
,
test
:
/
[\\/]
element-ui
[\\/]
/
,
chunks
:
"all"
},
commons
:
{
name
:
'chunk-commons'
,
test
:
path
.
resolve
(
__dirname
,
"/src/components"
),
minChunks
:
2
,
priority
:
-
20
,
reuseExistingChunk
:
true
},
}
});
// 缓存持久化
_config
.
optimization
.
runtimeChunk
(
"single"
);
// 图片压缩
_config
.
module
.
rule
(
'images'
)
.
test
(
/
\.(
png|jpe
?
g|gif|svg
)(\?
.*
)?
$/
)
.
use
(
'image-webpack-loader'
)
.
loader
(
'image-webpack-loader'
)
.
options
({
bypassOnDebug
:
true
})
.
end
();
// 开启gzip压缩
_config
.
plugin
(
'CompressionPlugin'
)
.
use
(
'compression-webpack-plugin'
,
[{
test
:
/
\.
js$|
\.
css$|
\.
html$/
,
// gzip压缩规则
threshold
:
10240
,
// 大于10K的数据会被压缩
filename
:
'[path][base].gz'
,
algorithm
:
'gzip'
,
// 压缩方式
minRatio
:
1
,
// 压缩比小于这个的才压缩
deleteOriginalAssets
:
false
,
}])
.
end
();
// 添加打包体积分析
_config
.
plugin
(
"webpack-bundle-analyzer"
).
use
(
BundleAnalyzerPlugin
).
end
();
});
},
// 本地代理服务器
// devServer: {
// overlay: {
// warnings: true,
// errors: true
// },
// host: '0.0.0.0',
// port: 6666,
// open: true,
// proxy: {
// [process.env.VUE_APP_BASE_API]: {
// target: ``,
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
// },
// },
// disableHostCheck: true
// },
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment