Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react 路由 history 模式-资源路径配置 #35

Open
huangshuwei opened this issue Jan 8, 2020 · 0 comments
Open

react 路由 history 模式-资源路径配置 #35

huangshuwei opened this issue Jan 8, 2020 · 0 comments
Labels
react react

Comments

@huangshuwei
Copy link
Owner

huangshuwei commented Jan 8, 2020

前言

修改了路由模式为 BrowserRouter,站点服务器也做好了配置。开发模式一切正常,发布后发现页面无法正常访问。这时候你就要想是否是资源路径配置的问题了。

看似是小问题,但常常会忽略,导致折腾了数个小时才排查到,具体细节不说了

配置

如果是使用 create-react-app 这个打包奇慢无比的脚手架,你只需要在“官方文档”的帮助下,修改配置即可。在 package.json 文件中添加一个节点,具体为:

"homepage": "/"

--完--

@huangshuwei huangshuwei added the react react label Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react react
Projects
None yet
Development

No branches or pull requests

1 participant