Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-game
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 57cac9af
authored
Feb 17, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
76dec7bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
9 deletions
public/index.html
vue.config.js
public/index.html
View file @
57cac9a
...
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-01-31 15:41:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-17 20:0
4:27
* @LastEditTime: 2023-02-17 20:0
9:26
* @FilePath: \h5Demo\public\index.html
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
...
...
@@ -14,9 +14,9 @@
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
>
<title>
</title>
<script
src=
"https://img02.glsx.com.cn/weapp/resource/h5/pako.min.js"
crossorigin=
"anonymous"
></script>
<script
src=
"https://img02.glsx.com.cn/weapp/resource/h5/pako.min.js"
></script>
<!-- <script src="./js/gp-js-sdk.js"></script> -->
<script
src=
"https://img02.glsx.com.cn/weapp/resource/h5/gp-js-sdk.min.js"
crossorigin=
"anonymous"
></script>
<script
src=
"https://img02.glsx.com.cn/weapp/resource/h5/gp-js-sdk.min.js"
></script>
</head>
<body>
...
...
vue.config.js
View file @
57cac9a
...
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-01-31 15:41:18
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2023-02-1
6 13:47:13
* @LastEditTime: 2023-02-1
7 20:11:05
* @FilePath: \h5Demo\vue.config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -65,10 +65,149 @@ module.exports = {
// }
// }
},
pluginOptions
:
{
"style-resources-loader"
:
{
preProcessor
:
"less"
,
patterns
:
[
"./src/assets/css/variables.less"
],
},
configureWebpack
:
(
config
)
=>
{
config
.
name
=
name
;
config
.
resolve
.
modules
=
[
"node_modules"
,
"./src/assets/spritesmith"
];
const
Plugins
=
[
new
SpritesmithPlugin
({
// 引入图片文件夹
src
:
{
cwd
:
path
.
resolve
(
__dirname
,
"./src/assets/spritesmith"
),
glob
:
[
"*.png"
,
"*.jpg"
],
},
// 生成图片的路径
target
:
{
image
:
path
.
resolve
(
__dirname
,
"./src/assets/images/sprite.png"
),
// 生成SCSS
css
:
[
[
path
.
resolve
(
__dirname
,
"./src/assets/css/sprite.scss"
),
{
format
:
"function_based_template"
,
},
],
],
},
customTemplates
:
{
function_based_template
:
spritesmithFunction
,
},
//background引用路径
apiOptions
:
{
cssImageRef
:
"../images/sprite.png"
,
},
// 每个图片间距
spritesmithOptions
:
{
padding
:
20
,
},
}),
];
config
.
plugins
=
[...
config
.
plugins
,
...
Plugins
];
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
// sentry 配置自带上传
process
.
env
.
NODE_ENV
===
"production"
&&
Object
.
assign
(
config
,
{
plugins
:
[
...
config
.
plugins
,
new
SentryWebpackPlugin
({
// webpack specific configuration
release
:
"0.0.1"
,
include
:
"./dist"
,
// 需要上传到sentry服务器的资源目录,会自动匹配js 以及map文件
ignore
:
[
"node_modules"
,
"vue.config.js"
],
// 忽略文件目录,当然我们在inlcude中制定了文件路径,这个忽略目录可以不加
configFile
:
".sentryclirc"
,
urlPrefix
:
"~/dj-carlife-web/"
,
}),
],
});
},
chainWebpack
:
(
config
)
=>
{
config
.
plugins
.
delete
(
"preload"
);
// TODO: need test
config
.
plugins
.
delete
(
"prefetch"
);
// TODO: need test
// 别名 alias
config
.
resolve
.
alias
.
set
(
"@"
,
resolve
(
"src"
))
.
set
(
"assets"
,
resolve
(
"src/assets"
))
.
set
(
"api"
,
resolve
(
"src/api"
))
.
set
(
"views"
,
resolve
(
"src/views"
))
.
set
(
"components"
,
resolve
(
"src/components"
))
.
set
(
"plugins"
,
resolve
(
"src/components"
))
.
set
(
"utils"
,
resolve
(
"src/utils"
));
/**
* 添加CDN参数到htmlWebpackPlugin配置中
*/
config
.
plugin
(
"html"
).
tap
((
args
)
=>
{
args
[
0
].
cdn
=
cdn
;
return
args
;
});
/**
* 设置保留空格
*/
config
.
module
.
rule
(
"vue"
)
.
use
(
"vue-loader"
)
.
loader
(
"vue-loader"
)
.
tap
((
options
)
=>
{
options
.
compilerOptions
.
preserveWhitespace
=
true
;
return
options
;
})
.
end
();
/**
* 打包分析
*/
if
(
IS_PROD
)
{
config
.
plugin
(
"webpack-report"
).
use
(
BundleAnalyzerPlugin
,
[
{
analyzerMode
:
"static"
,
},
]);
}
config
// https://webpack.js.org/configuration/devtool/#development
.
when
(
!
IS_PROD
,
(
config
)
=>
config
.
devtool
(
"cheap-source-map"
));
config
.
when
(
IS_PROD
,
(
config
)
=>
{
config
.
plugin
(
"ScriptExtHtmlWebpackPlugin"
)
.
after
(
"html"
)
.
use
(
"script-ext-html-webpack-plugin"
,
[
{
// 将 runtime 作为内联引入不单独存在
inline
:
/runtime
\.
.*
\.
js$/
,
},
])
.
end
();
config
.
optimization
.
splitChunks
({
chunks
:
"all"
,
cacheGroups
:
{
// cacheGroups 下可以可以配置多个组,每个组根据test设置条件,符合test条件的模块
commons
:
{
name
:
"chunk-commons"
,
test
:
resolve
(
"src/components"
),
minChunks
:
3
,
// 被至少用三次以上打包分离
priority
:
5
,
// 优先级
reuseExistingChunk
:
true
,
// 表示是否使用已有的 chunk,如果为 true 则表示如果当前的 chunk 包含的模块已经被抽取出去了,那么将不会重新生成新的。
},
node_vendors
:
{
name
:
"chunk-libs"
,
chunks
:
"initial"
,
// 只打包初始时依赖的第三方
test
:
/
[\\/]
node_modules
[\\/]
/
,
priority
:
10
,
},
vantUI
:
{
name
:
"chunk-vantUI"
,
// 单独将 vantUI 拆包
priority
:
20
,
// 数字大权重到,满足多个 cacheGroups 的条件时候分到权重高的
test
:
/
[\\/]
node_modules
[\\/]
_
?
vant
(
.*
)
/
,
},
},
});
config
.
optimization
.
runtimeChunk
(
"single"
);
});
},
};
Write
Preview
Markdown
is supported
Attach a file
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 post a comment