1.我在build:dev之后使用开发环境,在使用BrowserRouter的情况下,在访问/xxx/xx路由的时候会出现js、css的访问路径不对的问题,如果没有子路由,即访问/xxx的时候,就不会出现资源未找到的问题。不过,很有趣的是,在我build:prod,使用线上环境的时候,完全没有访问资源未找到的问题。
2.同上,在使用HashRouter之后,两种方式都能访问到正确的资源
以下是在开发环境build:dev情况下,使用BrowserRouter报错的代码,访问的路由是/clazz/mine
mine:7 GET http://localhost:2000/clazz/styles.0e5e392ec56e90c77a2c04e625bd6167.css net::ERR_ABORTED
mine:7 GET http://localhost:2000/clazz/styles.css net::ERR_ABORTED
mine:10 GET http://localhost:2000/clazz/common.495e63fa.js net::ERR_ABORTED
mine:10 GET http://localhost:2000/clazz/vendor.495e63fa.js net::ERR_ABORTED
mine:10 GET http://localhost:2000/clazz/main.495e63fa.js net::ERR_ABORTED