【发布时间】:2018-02-18 16:58:42
【问题描述】:
在我的 create-react-app (CRA) 应用程序中,我可以按照官方指南 https://reactjs.org/docs/code-splitting.html#route-based-code-splitting 轻松设置基于路由的代码分割
现在我可以将每条路由分成自己的 JS 块,但我宁愿创建 2 个不同的包(一个用于我主页的公共区域,一个用于登录用户的所有页面)。
如何将我的应用程序分成这两个包? (我还在用 react-router v3)
编辑:我的路线设置如下:
<Route
path="/onepage/:id"
component={RequireAuth(props => <Component1 {...props} />)}
/>
<Route
path="/anotherpage"
component={RequireAuth(props => <Component2 {...props} />)}
/>
是否可以将它们包装在更高级别的路由中(不改变路径本身)?
【问题讨论】:
标签: reactjs webpack create-react-app code-splitting