Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 47a0d034
authored
Jan 06, 2021
by
xinlaa
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
移动端增加初始配置
1 parent
8279acdb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
1 deletions
linkwe-mobile/package-lock.json
linkwe-mobile/package.json
linkwe-mobile/src/main.js
linkwe-mobile/vue.config.js
linkwe-mobile/package-lock.json
View file @
47a0d03
This diff is collapsed.
Click to expand it.
linkwe-mobile/package.json
View file @
47a0d03
{
"name"
:
"link-wechat-mobile"
,
"version"
:
"0.1.0"
,
"private"
:
true
,
"description"
:
"LinkWeChat mobile"
,
"license"
:
"GPL-3.0"
,
"scripts"
:
{
"serve"
:
"vue-cli-service serve"
,
"build"
:
"vue-cli-service build"
,
...
...
@@ -26,9 +27,13 @@
"eslint"
:
"^6.7.2"
,
"eslint-plugin-prettier"
:
"^3.1.3"
,
"eslint-plugin-vue"
:
"^6.2.2"
,
"html-webpack-plugin"
:
"^4.5.1"
,
"less"
:
"^3.0.4"
,
"less-loader"
:
"^5.0.0"
,
"prettier"
:
"^1.19.1"
,
"script-ext-html-webpack-plugin"
:
"^2.1.5"
,
"style-resources-loader"
:
"^1.3.2"
,
"vue-cli-plugin-style-resources-loader"
:
"~0.1.4"
,
"vue-template-compiler"
:
"^2.6.11"
},
"eslintConfig"
:
{
...
...
linkwe-mobile/src/main.js
View file @
47a0d03
import
wx
from
'@/utils/jweixin-1.2.0.js'
import
Vue
from
'vue'
import
Vant
from
'vant'
import
'vant/lib/index.css'
Vue
.
use
(
Vant
)
import
App
from
'./App.vue'
import
router
from
'./router'
import
store
from
'./store'
...
...
linkwe-mobile/vue.config.js
0 → 100644
View file @
47a0d03
const
path
=
require
(
'path'
)
const
resolve
=
(
dir
)
=>
{
return
path
.
join
(
__dirname
,
dir
)
}
process
.
env
.
VUE_APP_TITLE
=
require
(
'./package.json'
).
description
// 项目部署基础
// 默认情况下,我们假设你的应用将被部署在域的根目录下,
// 例如:https://www.my-app.com/
// 默认:'/'
// 如果您的应用程序部署在子路径中,则需要在这指定子路径
// 例如:https://www.my-app.com/my-app/
// 需要将它改为'/my-app/'
const
BASE_URL
=
process
.
env
.
NODE_ENV
===
'development'
?
'/'
:
'/mobile'
module
.
exports
=
{
publicPath
:
BASE_URL
,
outputDir
:
'mobile'
,
// 打包名称
// 打包时不生成.map文件
productionSourceMap
:
false
,
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave
:
false
,
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
devServer
:
{
host
:
'0.0.0.0'
,
port
:
8082
,
// 自动打开浏览器
open
:
true
,
proxy
:
{
// detail: https://cli.vuejs.org/config/#devserver-proxy
[
'http'
]:
{
target
:
process
.
env
.
VUE_APP_BASE_API
,
changeOrigin
:
true
,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
},
},
disableHostCheck
:
true
,
},
pluginOptions
:
{
'style-resources-loader'
:
{
preProcessor
:
'less'
,
patterns
:
[
path
.
resolve
(
__dirname
,
'./src/styles/varibles.less'
)],
},
},
configureWebpack
:
{
resolve
:
{
alias
:
{
'@'
:
resolve
(
'src'
),
},
},
},
chainWebpack
(
config
)
{
config
.
plugin
(
'preload'
).
tap
(()
=>
[
{
rel
:
'preload'
,
// to ignore runtime.js
fileBlacklist
:
[
/
\.
map$/
,
/hot-update
\.
js$/
,
/runtime
\.
.*
\.
js$/
],
include
:
'initial'
,
},
])
config
.
when
(
process
.
env
.
NODE_ENV
!==
'development'
,
(
config
)
=>
{
config
.
plugin
(
'ScriptExtHtmlWebpackPlugin'
)
.
after
(
'html'
)
.
use
(
'script-ext-html-webpack-plugin'
,
[
{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline
:
/runtime
\.
.*
\.
js$/
,
},
])
.
end
()
config
.
optimization
.
minimizer
(
'terser'
).
tap
((
options
)
=>
{
options
[
0
].
terserOptions
.
compress
.
drop_console
=
true
options
[
0
].
terserOptions
.
compress
.
drop_debugger
=
true
return
options
})
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-vant'
,
// split vant into a single package
priority
:
20
,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
test
:
/
[\\/]
node_modules
[\\/]
_
?
vant
(
.*
)
/
,
// in order to adapt to cnpm
},
commons
:
{
name
:
'chunk-commons'
,
test
:
resolve
(
'src/components'
),
// can customize your rules
minChunks
:
3
,
// minimum common number
priority
:
5
,
reuseExistingChunk
:
true
,
},
},
})
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