前端react项目打包过程记录

前端react项目打包过程记录

1.打包命令

npm run build

得到打包后的build文件夹,压缩build文件

2.使用serve来运行发布版本

该步骤可忽略

npm instll -g serve

serve -s build

3.将打包好的文件传入服务器

使用finalShell连接远程服务器

将build文件放入服务器中

解压文件 unzip build.zip

遇到的问题

react项目打包部署上线完毕后,刷新报错404

问题描述:路由本地跳转正常,打包后运行出现路由无法正常跳转的问题

http://wjhsh.net/duxingdexin-p-10129476.html

新建文件hostname.js

// export const hostname = ''
export const hostname = 'http://XXX.XXX.XXX.XXX:9999'
axios.get(hostname+'/manger/getAllStudentInfo',{})
posted @   Lu西西  阅读(292)  评论(0编辑  收藏  举报
相关博文:
点击右上角即可分享
微信分享提示