aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/routes.js
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-03-27 12:04:48 +0200
committerGitHub <noreply@github.com>2017-03-27 12:04:48 +0200
commit7d963d84f40ee3db3b51c557fb596aa9febf82bb (patch)
tree7f761f198fae4ad898f4dd98703923921520098b /server/sonar-web/src/main/js/apps/projects/routes.js
parent48699b502c866ea5a309c57f8ad5e737d1933280 (diff)
downloadsonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.tar.gz
sonarqube-7d963d84f40ee3db3b51c557fb596aa9febf82bb.zip
optimize js bundles (#1855)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/routes.js')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/routes.js49
1 files changed, 31 insertions, 18 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/routes.js b/server/sonar-web/src/main/js/apps/projects/routes.js
index 371a29f49a9..8eccdcd0ccc 100644
--- a/server/sonar-web/src/main/js/apps/projects/routes.js
+++ b/server/sonar-web/src/main/js/apps/projects/routes.js
@@ -17,23 +17,36 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import React from 'react';
-import { Route, IndexRoute } from 'react-router';
-import App from './components/App';
-import DefaultPageSelector from './components/DefaultPageSelector';
-import FavoriteProjectsContainer from './components/FavoriteProjectsContainer';
import { saveAll } from './utils';
-export default (
- <Route component={App}>
- <IndexRoute component={DefaultPageSelector} />
- <Route
- path="all"
- onEnter={(_, replace) => {
- saveAll();
- replace('/projects');
- }}
- />
- <Route path="favorite" component={FavoriteProjectsContainer} />
- </Route>
-);
+const routes = [
+ {
+ getComponent(_, callback) {
+ require.ensure([], require => callback(null, require('./components/App').default));
+ },
+ childRoutes: [
+ {
+ getIndexRoute(_, callback) {
+ require.ensure([], require =>
+ callback(null, { component: require('./components/DefaultPageSelector').default }));
+ }
+ },
+ {
+ path: 'all',
+ onEnter(_, replace) {
+ saveAll();
+ replace('/projects');
+ }
+ },
+ {
+ path: 'favorite',
+ getComponent(_, callback) {
+ require.ensure([], require =>
+ callback(null, require('./components/FavoriteProjectsContainer').default));
+ }
+ }
+ ]
+ }
+];
+
+export default routes;