啓動:npm run dev
部署:打包npm run build:prod(會多一個文件夾dist)
*tomcat部署*
將dist文件夾部署在tomcat的webapps下
http:localhost:8080/dist
*nginx部署*
修改nginx/conf/nginx.conf的server
location / {
try_files $uri $uri/ /index.html;
}
將dist文件夾部署在nginx的html下,http:localhost:8080/dist
----------------------------------------------------------------------------------------------
一 如果部署啓動後出現空白頁,無內容請如下修改
1.修改config/index.js(assetsPublicPath: '/'修改爲assetsPublicPath: './')
module.exports = {
dev: {
...
assetsPublicPath: './',
...
},
build: {
...
assetsPublicPath: './',
...
}
}
2. 如果 vue-router mode爲 history 模式,使用 nginx,vue-router 爲 hash 模式用tomcat(tomcat部署出錯時排查修改)
二 如果出現找不到.ttf及.woff文件的錯誤
修改webpack.base.config中limit: 10000,改爲limit: 100000