Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
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 2daa6e4b
authored
Sep 23, 2022
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
c2e7535e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
19 deletions
vue.config.js
vue.config.js
View file @
2daa6e4
...
@@ -27,7 +27,6 @@ const cdn = {
...
@@ -27,7 +27,6 @@ const cdn = {
'https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/libs/flv.min.1.6.2.js'
,
'https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/libs/flv.min.1.6.2.js'
,
'//web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.v4.5.2.min.js'
'//web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.v4.5.2.min.js'
]
]
}
}
/**
/**
...
@@ -37,14 +36,16 @@ const SpritesmithPlugin = require('webpack-spritesmith')
...
@@ -37,14 +36,16 @@ const SpritesmithPlugin = require('webpack-spritesmith')
const
spritesmithFunction
=
data
=>
{
const
spritesmithFunction
=
data
=>
{
let
{
spritesheet
,
sprites
}
=
data
let
{
spritesheet
,
sprites
}
=
data
let
shared
=
`.sprite-icon { background-image: url(
${
data
.
sprites
[
0
].
image
}
);background-size:
${
spritesheet
.
width
/
2
}
px
${
spritesheet
.
height
/
2
}
px;}`
let
shared
=
`.sprite-icon { background-image: url(
${
data
.
sprites
[
0
].
image
}
);background-size:
${
spritesheet
.
width
/
2
}
px
${
spritesheet
.
height
/
2
}
px;}`
let
perSprite
=
sprites
.
map
(
sprite
=>
{
let
perSprite
=
sprites
let
{
name
,
width
,
height
,
offset_x
,
offset_y
}
=
sprite
.
map
(
sprite
=>
{
return
`.icon-
${
name
}
{ width:
${
width
/
2
}
px; height:
${
height
/
2
}
px; background-position:
${
offset_x
/
2
}
px
${
offset_y
/
2
}
px;}`
let
{
name
,
width
,
height
,
offset_x
,
offset_y
}
=
sprite
}).
join
(
'\n'
)
return
`.icon-
${
name
}
{ width:
${
width
/
2
}
px; height:
${
height
/
2
}
px; background-position:
${
offset_x
/
2
}
px
${
offset_y
/
2
}
px;}`
})
.
join
(
'\n'
)
return
`
${
shared
}
\n
${
perSprite
}
`
return
`
${
shared
}
\n
${
perSprite
}
`
}
}
module
.
exports
=
{
module
.
exports
=
{
publicPath
:
IS_PROD
?
'./'
:
'/dj-scrm-wx-work-main-l
wk
/'
,
// 本地调试时需登录时使用
publicPath
:
IS_PROD
?
'./'
:
'/dj-scrm-wx-work-main-l
m
/'
,
// 本地调试时需登录时使用
// publicPath: './',
// publicPath: './',
// publicPath: '/dj-scrm-wx-work-attachment-activity/', // 署应用包时的基本 URL。 vue-router history模式使用
// publicPath: '/dj-scrm-wx-work-attachment-activity/', // 署应用包时的基本 URL。 vue-router history模式使用
outputDir
:
'dist'
,
// 生产环境构建文件的目录
outputDir
:
'dist'
,
// 生产环境构建文件的目录
...
@@ -53,6 +54,7 @@ module.exports = {
...
@@ -53,6 +54,7 @@ module.exports = {
productionSourceMap
:
false
,
// 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap
:
false
,
// 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer
:
{
devServer
:
{
disableHostCheck
:
true
,
disableHostCheck
:
true
,
// host: `192.168.2.222`,
port
:
9528
,
// 端口
port
:
9528
,
// 端口
open
:
false
,
// 启动后打开浏览器
open
:
false
,
// 启动后打开浏览器
public
:
'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/#/'
,
public
:
'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-main/#/'
,
...
@@ -101,13 +103,16 @@ module.exports = {
...
@@ -101,13 +103,16 @@ module.exports = {
image
:
path
.
resolve
(
__dirname
,
'./src/assets/images/sprite.png'
),
image
:
path
.
resolve
(
__dirname
,
'./src/assets/images/sprite.png'
),
// 生成SCSS
// 生成SCSS
css
:
[
css
:
[
[
path
.
resolve
(
__dirname
,
'./src/assets/css/sprite.scss'
),
{
[
format
:
'function_based_template'
path
.
resolve
(
__dirname
,
'./src/assets/css/sprite.scss'
),
}]
{
format
:
'function_based_template'
}
]
]
]
},
},
customTemplates
:
{
customTemplates
:
{
'function_based_template'
:
spritesmithFunction
,
function_based_template
:
spritesmithFunction
},
},
//background引用路径
//background引用路径
apiOptions
:
{
apiOptions
:
{
...
@@ -145,7 +150,7 @@ module.exports = {
...
@@ -145,7 +150,7 @@ module.exports = {
* 添加CDN参数到htmlWebpackPlugin配置中
* 添加CDN参数到htmlWebpackPlugin配置中
*/
*/
config
.
plugin
(
'html'
).
tap
(
args
=>
{
config
.
plugin
(
'html'
).
tap
(
args
=>
{
args
[
0
].
cdn
=
cdn
args
[
0
].
cdn
=
cdn
return
args
return
args
})
})
...
@@ -165,9 +170,11 @@ module.exports = {
...
@@ -165,9 +170,11 @@ module.exports = {
* 打包分析
* 打包分析
*/
*/
if
(
IS_PROD
)
{
if
(
IS_PROD
)
{
config
.
plugin
(
'webpack-report'
).
use
(
BundleAnalyzerPlugin
,
[{
config
.
plugin
(
'webpack-report'
).
use
(
BundleAnalyzerPlugin
,
[
analyzerMode
:
'static'
{
}])
analyzerMode
:
'static'
}
])
}
}
config
config
// https://webpack.js.org/configuration/devtool/#development
// https://webpack.js.org/configuration/devtool/#development
...
@@ -177,10 +184,12 @@ module.exports = {
...
@@ -177,10 +184,12 @@ module.exports = {
config
config
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
after
(
'html'
)
.
after
(
'html'
)
.
use
(
'script-ext-html-webpack-plugin'
,
[{
.
use
(
'script-ext-html-webpack-plugin'
,
[
// 将 runtime 作为内联引入不单独存在
{
inline
:
/runtime
\.
.*
\.
js$/
// 将 runtime 作为内联引入不单独存在
}])
inline
:
/runtime
\.
.*
\.
js$/
}
])
.
end
()
.
end
()
config
.
optimization
.
splitChunks
({
config
.
optimization
.
splitChunks
({
chunks
:
'all'
,
chunks
:
'all'
,
...
@@ -209,4 +218,4 @@ module.exports = {
...
@@ -209,4 +218,4 @@ module.exports = {
config
.
optimization
.
runtimeChunk
(
'single'
)
config
.
optimization
.
runtimeChunk
(
'single'
)
})
})
}
}
}
\ No newline at end of file
\ No newline at end of file
}
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