reactJS生产中的子文件夹映射

时间:2018-09-27 13:33:15

标签: javascript node.js reactjs react-router

我正在使用ConnectedRouter ConnectedRouter history = {history} ,并且历史记录在路由器版本中具有 const history = createHistory({basename:“ / url”}) - router-redux“:” ^ 5.0.0 ,问题是我有两个文件夹,并且部署了两个文件夹,所以我在index.js中区分了这些文件夹

app.get("/", function(req, res) { res.sendFile(path.join(__dirname, "../build/index.html")); });

  app.get("/seller/*", function(req, res) {
    res.sendFile(path.join(__dirname, "../build/seller/index.html"));
  });`

问题是第一个react文件夹已正确映射,但是当我提供指定的URL时第二个文件夹显示为空白

1 个答案:

答案 0 :(得分:0)

我刚刚通过在package.json “ homepage”:“ http://domainurl/seller中添加更改来解决上述问题,并在packagejson映射中为baseURL添加了homepage命令这一行您需要