Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
219 views
in Technique[技术] by (71.8m points)

wepack 打包react-router history 问题

用wepack 打包react-route的项目 如果想设置history 为browserHistory 是不是一定要开server 那项目要上线的时候咋办 或者有别的解决方法 刚上手react求解


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

我想你说的开server指的是webpack-dev-server吧,那是不用的。只要在nginx或者apache等服务器中配置好重写规则就可以了,当404时所有请求都rewrite到index.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...