diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index 68020651d9..9e5ecb03b4 100644
--- a/webapp/actions/channel_actions.jsx
+++ b/webapp/actions/channel_actions.jsx
@@ -1,7 +1,7 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import * as Utils from 'utils/utils.jsx';
import TeamStore from 'stores/team_store.jsx';
import UserStore from 'stores/user_store.jsx';
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index c4551a683b..d6456eb3a2 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -20,7 +20,7 @@ import * as I18n from 'i18n/i18n.jsx';
import {trackPage} from 'actions/analytics_actions.jsx';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import en from 'i18n/en.json';
diff --git a/webapp/actions/team_actions.jsx b/webapp/actions/team_actions.jsx
index 2cff86b4a6..249c9d5404 100644
--- a/webapp/actions/team_actions.jsx
+++ b/webapp/actions/team_actions.jsx
@@ -10,7 +10,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
import Client from 'utils/web_client.jsx';
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
export function checkIfTeamExists(teamName, onSuccess, onError) {
Client.findTeamByName(teamName, onSuccess, onError);
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx
index 7c8a014bac..11d7bbe186 100644
--- a/webapp/actions/websocket_actions.jsx
+++ b/webapp/actions/websocket_actions.jsx
@@ -18,7 +18,7 @@ import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
const SocketEvents = Constants.SocketEvents;
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
const MAX_WEBSOCKET_FAILS = 7;
const WEBSOCKET_RETRY_TIME = 3000;
diff --git a/webapp/components/admin_console/admin_navbar_dropdown.jsx b/webapp/components/admin_console/admin_navbar_dropdown.jsx
index 65a76a517d..0bac263efc 100644
--- a/webapp/components/admin_console/admin_navbar_dropdown.jsx
+++ b/webapp/components/admin_console/admin_navbar_dropdown.jsx
@@ -10,7 +10,7 @@ import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx
index 565279e720..cb98c8ab1c 100644
--- a/webapp/components/admin_console/admin_sidebar.jsx
+++ b/webapp/components/admin_console/admin_sidebar.jsx
@@ -11,7 +11,7 @@ import * as Utils from 'utils/utils.jsx';
import AdminSidebarHeader from './admin_sidebar_header.jsx';
import AdminSidebarTeam from './admin_sidebar_team.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import {OverlayTrigger, Tooltip} from 'react-bootstrap';
import SelectTeamModal from './select_team_modal.jsx';
import AdminSidebarCategory from './admin_sidebar_category.jsx';
diff --git a/webapp/components/admin_console/admin_sidebar_category.jsx b/webapp/components/admin_console/admin_sidebar_category.jsx
index 9f56d626b7..1cf96f9794 100644
--- a/webapp/components/admin_console/admin_sidebar_category.jsx
+++ b/webapp/components/admin_console/admin_sidebar_category.jsx
@@ -3,7 +3,7 @@
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class AdminSidebarCategory extends React.Component {
static get propTypes() {
diff --git a/webapp/components/admin_console/admin_sidebar_section.jsx b/webapp/components/admin_console/admin_sidebar_section.jsx
index 56e5206290..a958150b56 100644
--- a/webapp/components/admin_console/admin_sidebar_section.jsx
+++ b/webapp/components/admin_console/admin_sidebar_section.jsx
@@ -3,7 +3,7 @@
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class AdminSidebarSection extends React.Component {
static get propTypes() {
diff --git a/webapp/components/admin_console/user_item.jsx b/webapp/components/admin_console/user_item.jsx
index a337f23043..62de50f0f2 100644
--- a/webapp/components/admin_console/user_item.jsx
+++ b/webapp/components/admin_console/user_item.jsx
@@ -10,7 +10,7 @@ import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import React from 'react';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
export default class UserItem extends React.Component {
constructor(props) {
diff --git a/webapp/components/backstage/add_command.jsx b/webapp/components/backstage/add_command.jsx
index c817764aab..91af0416b4 100644
--- a/webapp/components/backstage/add_command.jsx
+++ b/webapp/components/backstage/add_command.jsx
@@ -9,7 +9,7 @@ import * as Utils from 'utils/utils.jsx';
import BackstageHeader from './backstage_header.jsx';
import {FormattedMessage} from 'react-intl';
import FormError from 'components/form_error.jsx';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import SpinnerButton from 'components/spinner_button.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/backstage/add_incoming_webhook.jsx b/webapp/components/backstage/add_incoming_webhook.jsx
index f698f2b13e..528f03377e 100644
--- a/webapp/components/backstage/add_incoming_webhook.jsx
+++ b/webapp/components/backstage/add_incoming_webhook.jsx
@@ -10,7 +10,7 @@ import BackstageHeader from './backstage_header.jsx';
import ChannelSelect from 'components/channel_select.jsx';
import {FormattedMessage} from 'react-intl';
import FormError from 'components/form_error.jsx';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import SpinnerButton from 'components/spinner_button.jsx';
export default class AddIncomingWebhook extends React.Component {
diff --git a/webapp/components/backstage/add_outgoing_webhook.jsx b/webapp/components/backstage/add_outgoing_webhook.jsx
index d48be3ac48..5f9d96249f 100644
--- a/webapp/components/backstage/add_outgoing_webhook.jsx
+++ b/webapp/components/backstage/add_outgoing_webhook.jsx
@@ -10,7 +10,7 @@ import BackstageHeader from './backstage_header.jsx';
import ChannelSelect from 'components/channel_select.jsx';
import {FormattedMessage} from 'react-intl';
import FormError from 'components/form_error.jsx';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import SpinnerButton from 'components/spinner_button.jsx';
export default class AddOutgoingWebhook extends React.Component {
diff --git a/webapp/components/backstage/backstage_category.jsx b/webapp/components/backstage/backstage_category.jsx
index 8e6c8541bd..1d4b11ca3d 100644
--- a/webapp/components/backstage/backstage_category.jsx
+++ b/webapp/components/backstage/backstage_category.jsx
@@ -3,7 +3,7 @@
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class BackstageCategory extends React.Component {
static get propTypes() {
diff --git a/webapp/components/backstage/backstage_navbar.jsx b/webapp/components/backstage/backstage_navbar.jsx
index 8352296b77..26ab44c878 100644
--- a/webapp/components/backstage/backstage_navbar.jsx
+++ b/webapp/components/backstage/backstage_navbar.jsx
@@ -8,7 +8,7 @@ import React from 'react';
import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class BackstageNavbar extends React.Component {
constructor(props) {
diff --git a/webapp/components/backstage/backstage_section.jsx b/webapp/components/backstage/backstage_section.jsx
index 120e956b0b..c8b63af18d 100644
--- a/webapp/components/backstage/backstage_section.jsx
+++ b/webapp/components/backstage/backstage_section.jsx
@@ -3,7 +3,7 @@
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class BackstageSection extends React.Component {
static get propTypes() {
diff --git a/webapp/components/backstage/installed_integrations.jsx b/webapp/components/backstage/installed_integrations.jsx
index cff0611d75..f6de8bc112 100644
--- a/webapp/components/backstage/installed_integrations.jsx
+++ b/webapp/components/backstage/installed_integrations.jsx
@@ -5,7 +5,7 @@ import React from 'react';
import * as Utils from 'utils/utils.jsx';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import LoadingScreen from 'components/loading_screen.jsx';
export default class InstalledIntegrations extends React.Component {
diff --git a/webapp/components/backstage/integration_option.jsx b/webapp/components/backstage/integration_option.jsx
index dd7cc0c4c9..483e6a8882 100644
--- a/webapp/components/backstage/integration_option.jsx
+++ b/webapp/components/backstage/integration_option.jsx
@@ -3,7 +3,7 @@
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class IntegrationOption extends React.Component {
static get propTypes() {
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 181d37ca2a..70a4b1bfe9 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -31,7 +31,7 @@ import Client from 'utils/web_client.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
const ActionTypes = Constants.ActionTypes;
diff --git a/webapp/components/claim/claim_controller.jsx b/webapp/components/claim/claim_controller.jsx
index dbb944bb9f..581438ce90 100644
--- a/webapp/components/claim/claim_controller.jsx
+++ b/webapp/components/claim/claim_controller.jsx
@@ -3,7 +3,7 @@
import React from 'react';
import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import logoImage from 'images/logo.png';
diff --git a/webapp/components/claim/components/oauth_to_email.jsx b/webapp/components/claim/components/oauth_to_email.jsx
index ba01a8adf7..17ca122641 100644
--- a/webapp/components/claim/components/oauth_to_email.jsx
+++ b/webapp/components/claim/components/oauth_to_email.jsx
@@ -7,7 +7,7 @@ import Client from 'utils/web_client.jsx';
import React from 'react';
import ReactDOM from 'react-dom';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
export default class OAuthToEmail extends React.Component {
constructor(props) {
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx
index caf58c7442..eedae85714 100644
--- a/webapp/components/create_post.jsx
+++ b/webapp/components/create_post.jsx
@@ -24,7 +24,7 @@ import PreferenceStore from 'stores/preference_store.jsx';
import Constants from 'utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
const Preferences = Constants.Preferences;
const TutorialSteps = Constants.TutorialSteps;
diff --git a/webapp/components/create_team/components/display_name.jsx b/webapp/components/create_team/components/display_name.jsx
index e6dcd221a1..a4d47477af 100644
--- a/webapp/components/create_team/components/display_name.jsx
+++ b/webapp/components/create_team/components/display_name.jsx
@@ -10,7 +10,7 @@ import logoImage from 'images/logo.png';
import React from 'react';
import ReactDOM from 'react-dom';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import {FormattedMessage} from 'react-intl';
export default class TeamSignupDisplayNamePage extends React.Component {
diff --git a/webapp/components/create_team/create_team_controller.jsx b/webapp/components/create_team/create_team_controller.jsx
index ad2a008bdb..47df82a57a 100644
--- a/webapp/components/create_team/create_team_controller.jsx
+++ b/webapp/components/create_team/create_team_controller.jsx
@@ -4,7 +4,7 @@
import ErrorBar from 'components/error_bar.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/delete_channel_modal.jsx b/webapp/components/delete_channel_modal.jsx
index b2870cd508..925fa163c9 100644
--- a/webapp/components/delete_channel_modal.jsx
+++ b/webapp/components/delete_channel_modal.jsx
@@ -9,7 +9,7 @@ import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/do_verify_email.jsx b/webapp/components/do_verify_email.jsx
index 1932052660..c54d32b563 100644
--- a/webapp/components/do_verify_email.jsx
+++ b/webapp/components/do_verify_email.jsx
@@ -5,7 +5,7 @@ import {FormattedMessage} from 'react-intl';
import Client from 'utils/web_client.jsx';
import LoadingScreen from './loading_screen.jsx';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/error_page.jsx b/webapp/components/error_page.jsx
index 53f0fce82c..f498c4e8ec 100644
--- a/webapp/components/error_page.jsx
+++ b/webapp/components/error_page.jsx
@@ -4,7 +4,7 @@
import $ from 'jquery';
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import * as Utils from 'utils/utils.jsx';
diff --git a/webapp/components/file_info_preview.jsx b/webapp/components/file_info_preview.jsx
index fe4e76f913..b3d16b6a6e 100644
--- a/webapp/components/file_info_preview.jsx
+++ b/webapp/components/file_info_preview.jsx
@@ -5,7 +5,7 @@ import * as Utils from 'utils/utils.jsx';
import {defineMessages} from 'react-intl';
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
const holders = defineMessages({
type: {
diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx
index dce92dd647..6752b56cd6 100644
--- a/webapp/components/logged_in.jsx
+++ b/webapp/components/logged_in.jsx
@@ -11,7 +11,7 @@ import * as Utils from 'utils/utils.jsx';
import * as Websockets from 'actions/websocket_actions.jsx';
import Constants from 'utils/constants.jsx';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
const CLIENT_STATUS_INTERVAL = 30000;
const BACKSPACE_CHAR = 8;
diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx
index ab8b49392d..653908654e 100644
--- a/webapp/components/login/login_controller.jsx
+++ b/webapp/components/login/login_controller.jsx
@@ -16,7 +16,7 @@ import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import React from 'react';
import logoImage from 'images/logo.png';
diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx
index b0847bd734..54a06d0ae6 100644
--- a/webapp/components/more_channels.jsx
+++ b/webapp/components/more_channels.jsx
@@ -12,7 +12,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import React from 'react';
import ReactDOM from 'react-dom';
diff --git a/webapp/components/more_direct_channels.jsx b/webapp/components/more_direct_channels.jsx
index de61bcf989..aaa49571e3 100644
--- a/webapp/components/more_direct_channels.jsx
+++ b/webapp/components/more_direct_channels.jsx
@@ -9,7 +9,7 @@ import * as Utils from 'utils/utils.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import SpinnerButton from 'components/spinner_button.jsx';
import LoadingScreen from 'components/loading_screen.jsx';
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index 32682bc781..1942022bbb 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -33,7 +33,7 @@ import {FormattedMessage} from 'react-intl';
import {Popover, OverlayTrigger} from 'react-bootstrap';
-import {Link, browserHistory} from 'react-router';
+import {Link, browserHistory} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx
index 6065f3474c..9d6d7fb22a 100644
--- a/webapp/components/navbar_dropdown.jsx
+++ b/webapp/components/navbar_dropdown.jsx
@@ -16,7 +16,7 @@ import UserSettingsModal from './user_settings/user_settings_modal.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/needs_team.jsx b/webapp/components/needs_team.jsx
index 9557582374..5aabcb55ca 100644
--- a/webapp/components/needs_team.jsx
+++ b/webapp/components/needs_team.jsx
@@ -5,7 +5,7 @@ import React from 'react';
import $ from 'jquery';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import * as Utils from 'utils/utils.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import TeamStore from 'stores/team_store.jsx';
diff --git a/webapp/components/new_channel_flow.jsx b/webapp/components/new_channel_flow.jsx
index 7019da4aae..db06cf0be2 100644
--- a/webapp/components/new_channel_flow.jsx
+++ b/webapp/components/new_channel_flow.jsx
@@ -9,7 +9,7 @@ import NewChannelModal from './new_channel_modal.jsx';
import ChangeURLModal from './change_url_modal.jsx';
import {intlShape, injectIntl, defineMessages} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import Constants from 'utils/constants.jsx';
diff --git a/webapp/components/password_reset_form.jsx b/webapp/components/password_reset_form.jsx
index eeea265d84..05bf29eae5 100644
--- a/webapp/components/password_reset_form.jsx
+++ b/webapp/components/password_reset_form.jsx
@@ -7,7 +7,7 @@ import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/password_reset_send_link.jsx b/webapp/components/password_reset_send_link.jsx
index 65d9439bd0..48179e162b 100644
--- a/webapp/components/password_reset_send_link.jsx
+++ b/webapp/components/password_reset_send_link.jsx
@@ -9,7 +9,7 @@ import client from 'utils/web_client.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
class PasswordResetSendLink extends React.Component {
constructor(props) {
diff --git a/webapp/components/permalink_view.jsx b/webapp/components/permalink_view.jsx
index 8f443bc051..55e250d04a 100644
--- a/webapp/components/permalink_view.jsx
+++ b/webapp/components/permalink_view.jsx
@@ -10,7 +10,7 @@ import PostFocusViewController from 'components/post_view/post_focus_view_contro
import ChannelStore from 'stores/channel_store.jsx';
import TeamStore from 'stores/team_store.jsx';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import {FormattedMessage} from 'react-intl';
export default class PermalinkView extends React.Component {
diff --git a/webapp/components/popover_list_members.jsx b/webapp/components/popover_list_members.jsx
index d85b1114bb..28e45d5d66 100644
--- a/webapp/components/popover_list_members.jsx
+++ b/webapp/components/popover_list_members.jsx
@@ -10,7 +10,7 @@ import Constants from 'utils/constants.jsx';
import Client from 'utils/web_client.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/removed_from_channel_modal.jsx b/webapp/components/removed_from_channel_modal.jsx
index 2199dbbece..3164e4e3ff 100644
--- a/webapp/components/removed_from_channel_modal.jsx
+++ b/webapp/components/removed_from_channel_modal.jsx
@@ -9,7 +9,7 @@ import BrowserStore from 'stores/browser_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import React from 'react';
diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx
index abaa05bb59..977652e996 100644
--- a/webapp/components/root.jsx
+++ b/webapp/components/root.jsx
@@ -14,7 +14,7 @@ import React from 'react';
import FastClick from 'fastclick';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import UserStore from 'stores/user_store.jsx';
export default class Root extends React.Component {
diff --git a/webapp/components/search_results_item.jsx b/webapp/components/search_results_item.jsx
index 3fff4ea33d..2f453bc84f 100644
--- a/webapp/components/search_results_item.jsx
+++ b/webapp/components/search_results_item.jsx
@@ -16,7 +16,7 @@ const ActionTypes = Constants.ActionTypes;
import {FormattedMessage, FormattedDate} from 'react-intl';
import React from 'react';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
export default class SearchResultsItem extends React.Component {
constructor(props) {
diff --git a/webapp/components/select_team/select_team.jsx b/webapp/components/select_team/select_team.jsx
index a04961d5b6..3b1cf829ad 100644
--- a/webapp/components/select_team/select_team.jsx
+++ b/webapp/components/select_team/select_team.jsx
@@ -9,7 +9,7 @@ import LoadingScreen from 'components/loading_screen.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import {FormattedMessage} from 'react-intl';
diff --git a/webapp/components/should_verify_email.jsx b/webapp/components/should_verify_email.jsx
index a95101ba1f..18a936b13b 100644
--- a/webapp/components/should_verify_email.jsx
+++ b/webapp/components/should_verify_email.jsx
@@ -5,7 +5,7 @@ import {FormattedMessage} from 'react-intl';
import Client from 'utils/web_client.jsx';
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class ShouldVerifyEmail extends React.Component {
constructor(props) {
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index f6c2a1a5a5..4f678274d3 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -30,7 +30,7 @@ import {Tooltip, OverlayTrigger} from 'react-bootstrap';
import loadingGif from 'images/load.gif';
import React from 'react';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import favicon from 'images/favicon/favicon-16x16.png';
import redFavicon from 'images/favicon/redfavicon-16x16.png';
diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx
index e3a7bee7c2..622b803378 100644
--- a/webapp/components/sidebar_right_menu.jsx
+++ b/webapp/components/sidebar_right_menu.jsx
@@ -20,7 +20,7 @@ const Preferences = Constants.Preferences;
const TutorialSteps = Constants.TutorialSteps;
import {FormattedMessage} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
import {createMenuTip} from 'components/tutorial/tutorial_tip.jsx';
import React from 'react';
diff --git a/webapp/components/signup_team_complete/components/signup_team_complete.jsx b/webapp/components/signup_team_complete/components/signup_team_complete.jsx
index 00fdafe5f9..78c5913753 100644
--- a/webapp/components/signup_team_complete/components/signup_team_complete.jsx
+++ b/webapp/components/signup_team_complete/components/signup_team_complete.jsx
@@ -6,7 +6,7 @@ import BrowserStore from 'stores/browser_store.jsx';
import {FormattedMessage} from 'react-intl';
import React from 'react';
-import {Link, browserHistory} from 'react-router';
+import {Link, browserHistory} from 'react-router/es6';
export default class SignupTeamComplete extends React.Component {
constructor(props) {
diff --git a/webapp/components/signup_user_complete.jsx b/webapp/components/signup_user_complete.jsx
index 74eaebfa96..c7ddfc91bf 100644
--- a/webapp/components/signup_user_complete.jsx
+++ b/webapp/components/signup_user_complete.jsx
@@ -17,7 +17,7 @@ import Constants from 'utils/constants.jsx';
import React from 'react';
import ReactDOM from 'react-dom';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
-import {browserHistory, Link} from 'react-router';
+import {browserHistory, Link} from 'react-router/es6';
import logoImage from 'images/logo.png';
diff --git a/webapp/components/team_export_tab.jsx b/webapp/components/team_export_tab.jsx
index 37f886aab1..15c1314899 100644
--- a/webapp/components/team_export_tab.jsx
+++ b/webapp/components/team_export_tab.jsx
@@ -6,7 +6,7 @@ import Client from 'utils/web_client.jsx';
import {FormattedMessage} from 'react-intl';
import React from 'react';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
export default class TeamExportTab extends React.Component {
constructor(props) {
diff --git a/webapp/components/team_members_dropdown.jsx b/webapp/components/team_members_dropdown.jsx
index b65b9e0503..2b40da9cf1 100644
--- a/webapp/components/team_members_dropdown.jsx
+++ b/webapp/components/team_members_dropdown.jsx
@@ -12,7 +12,7 @@ import TeamStore from 'stores/team_store.jsx';
import {FormattedMessage} from 'react-intl';
import React from 'react';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
export default class TeamMembersDropdown extends React.Component {
constructor(props) {
diff --git a/webapp/components/tutorial/tutorial_intro_screens.jsx b/webapp/components/tutorial/tutorial_intro_screens.jsx
index af1ac4760d..3928b7f20a 100644
--- a/webapp/components/tutorial/tutorial_intro_screens.jsx
+++ b/webapp/components/tutorial/tutorial_intro_screens.jsx
@@ -10,7 +10,7 @@ import * as GlobalActions from 'actions/global_actions.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
const Preferences = Constants.Preferences;
diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx
index 4cf28715b4..af7aeb3c63 100644
--- a/webapp/components/user_settings/user_settings_security.jsx
+++ b/webapp/components/user_settings/user_settings_security.jsx
@@ -17,7 +17,7 @@ import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, FormattedTime, FormattedDate} from 'react-intl';
-import {Link} from 'react-router';
+import {Link} from 'react-router/es6';
const holders = defineMessages({
currentPasswordError: {
diff --git a/webapp/package.json b/webapp/package.json
index 263df21ca4..11264ec2d0 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -64,7 +64,7 @@
"sass-loader": "3.2.0",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
- "webpack": "2.1.0-beta.7",
+ "webpack": "2.1.0-beta.13",
"webpack-node-externals": "1.2.0"
},
"scripts": {
diff --git a/webapp/root.jsx b/webapp/root.jsx
index b6302a76f5..d5b9a6d476 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -4,106 +4,21 @@
import $ from 'jquery';
require('perfect-scrollbar/jquery')($);
+import React from 'react';
+import ReactDOM from 'react-dom';
+import {Router, browserHistory} from 'react-router/es6';
+import * as GlobalActions from 'actions/global_actions.jsx';
+import * as Websockets from 'actions/websocket_actions.jsx';
+import BrowserStore from 'stores/browser_store.jsx';
+import * as I18n from 'i18n/i18n.jsx';
+
+// Import our styles
import 'bootstrap-colorpicker/dist/css/bootstrap-colorpicker.css';
import 'google-fonts/google-fonts.css';
import 'sass/styles.scss';
-import React from 'react';
-import ReactDOM from 'react-dom';
-import {IndexRedirect, Router, Route, IndexRoute, Redirect, browserHistory} from 'react-router';
-import Root from 'components/root.jsx';
-import LoggedIn from 'components/logged_in.jsx';
-import HeaderFooterTemplate from 'components/header_footer_template.jsx';
-import NeedsTeam from 'components/needs_team.jsx';
-import PasswordResetSendLink from 'components/password_reset_send_link.jsx';
-import PasswordResetForm from 'components/password_reset_form.jsx';
-import ChannelView from 'components/channel_view.jsx';
-import PermalinkView from 'components/permalink_view.jsx';
-import Sidebar from 'components/sidebar.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-import ChannelStore from 'stores/channel_store.jsx';
-import ErrorStore from 'stores/error_store.jsx';
-import TeamStore from 'stores/team_store.jsx';
-import BrowserStore from 'stores/browser_store.jsx';
-import * as Utils from 'utils/utils.jsx';
-
-import Client from 'utils/web_client.jsx';
-
-import * as Websockets from 'actions/websocket_actions.jsx';
-import * as GlobalActions from 'actions/global_actions.jsx';
-import SignupUserComplete from 'components/signup_user_complete.jsx';
-import ShouldVerifyEmail from 'components/should_verify_email.jsx';
-import DoVerifyEmail from 'components/do_verify_email.jsx';
-import TutorialView from 'components/tutorial/tutorial_view.jsx';
-import BackstageNavbar from 'components/backstage/backstage_navbar.jsx';
-import BackstageSidebar from 'components/backstage/backstage_sidebar.jsx';
-import Integrations from 'components/backstage/integrations.jsx';
-import InstalledIncomingWebhooks from 'components/backstage/installed_incoming_webhooks.jsx';
-import InstalledOutgoingWebhooks from 'components/backstage/installed_outgoing_webhooks.jsx';
-import InstalledCommands from 'components/backstage/installed_commands.jsx';
-import AddIncomingWebhook from 'components/backstage/add_incoming_webhook.jsx';
-import AddOutgoingWebhook from 'components/backstage/add_outgoing_webhook.jsx';
-import AddCommand from 'components/backstage/add_command.jsx';
-import ErrorPage from 'components/error_page.jsx';
-
-import AppDispatcher from './dispatcher/app_dispatcher.jsx';
-import Constants from './utils/constants.jsx';
-const ActionTypes = Constants.ActionTypes;
-
-import AdminConsole from 'components/admin_console/admin_console.jsx';
-import SystemAnalytics from 'components/analytics/system_analytics.jsx';
-import ConfigurationSettings from 'components/admin_console/configuration_settings.jsx';
-import LocalizationSettings from 'components/admin_console/localization_settings.jsx';
-import UsersAndTeamsSettings from 'components/admin_console/users_and_teams_settings.jsx';
-import PrivacySettings from 'components/admin_console/privacy_settings.jsx';
-import LogSettings from 'components/admin_console/log_settings.jsx';
-import EmailAuthenticationSettings from 'components/admin_console/email_authentication_settings.jsx';
-import GitLabSettings from 'components/admin_console/gitlab_settings.jsx';
-import LdapSettings from 'components/admin_console/ldap_settings.jsx';
-import SignupSettings from 'components/admin_console/signup_settings.jsx';
-import LoginSettings from 'components/admin_console/login_settings.jsx';
-import PublicLinkSettings from 'components/admin_console/public_link_settings.jsx';
-import SessionSettings from 'components/admin_console/session_settings.jsx';
-import ConnectionSettings from 'components/admin_console/connection_settings.jsx';
-import EmailSettings from 'components/admin_console/email_settings.jsx';
-import PushSettings from 'components/admin_console/push_settings.jsx';
-import WebhookSettings from 'components/admin_console/webhook_settings.jsx';
-import ExternalServiceSettings from 'components/admin_console/external_service_settings.jsx';
-import DatabaseSettings from 'components/admin_console/database_settings.jsx';
-import StorageSettings from 'components/admin_console/storage_settings.jsx';
-import ImageSettings from 'components/admin_console/image_settings.jsx';
-import CustomBrandSettings from 'components/admin_console/custom_brand_settings.jsx';
-import CustomEmojiSettings from 'components/admin_console/custom_emoji_settings.jsx';
-import LegalAndSupportSettings from 'components/admin_console/legal_and_support_settings.jsx';
-import ComplianceSettings from 'components/admin_console/compliance_settings.jsx';
-import RateSettings from 'components/admin_console/rate_settings.jsx';
-import DeveloperSettings from 'components/admin_console/developer_settings.jsx';
-import TeamUsers from 'components/admin_console/team_users.jsx';
-import TeamAnalytics from 'components/analytics/team_analytics.jsx';
-import LicenseSettings from 'components/admin_console/license_settings.jsx';
-import Audits from 'components/admin_console/audits.jsx';
-import Logs from 'components/admin_console/logs.jsx';
-
-import ClaimController from 'components/claim/claim_controller.jsx';
-import EmailToOAuth from 'components/claim/components/email_to_oauth.jsx';
-import OAuthToEmail from 'components/claim/components/oauth_to_email.jsx';
-import LDAPToEmail from 'components/claim/components/ldap_to_email.jsx';
-import EmailToLDAP from 'components/claim/components/email_to_ldap.jsx';
-
-import LoginController from 'components/login/login_controller.jsx';
-import SelectTeam from 'components/select_team/select_team.jsx';
-import CreateTeamController from 'components/create_team/create_team_controller.jsx';
-import CreateTeamDisplayName from 'components/create_team/components/display_name.jsx';
-import CreateTeamTeamUrl from 'components/create_team/components/team_url.jsx';
-
-import * as I18n from 'i18n/i18n.jsx';
-
-const notFoundParams = {
- title: Utils.localizeMessage('error.not_found.title', 'Page not found'),
- message: Utils.localizeMessage('error.not_found.message', 'The page you were trying to reach does not exist'),
- link: '/',
- linkmessage: Utils.localizeMessage('error.not_found.link_message', 'Back to Mattermost')
-};
+// Import the root of our routing tree
+import rRoot from 'routes/route_root.jsx';
// This is for anything that needs to be done for ALL react components.
// This runs before we start to render anything.
@@ -157,470 +72,12 @@ function preRenderSetup(callwhendone) {
}
}
-function preLoggedIn(nextState, replace, callback) {
- ErrorStore.clearLastError();
- callback();
-}
-
-function preNeedsTeam(nextState, replace, callback) {
- // First check to make sure you're in the current team
- // for the current url.
- var teamName = Utils.getTeamNameFromUrl();
- var team = TeamStore.getByName(teamName);
- const oldTeamId = TeamStore.getCurrentId();
-
- if (!team) {
- browserHistory.push('/');
- return;
- }
-
- GlobalActions.emitCloseRightHandSide();
-
- TeamStore.saveMyTeam(team);
- TeamStore.emitChange();
-
- // If the old team id is null then we will already have the direct
- // profiles from initial load
- if (oldTeamId != null) {
- AsyncClient.getDirectProfiles();
- }
-
- var d1 = $.Deferred(); //eslint-disable-line new-cap
- var d2 = $.Deferred(); //eslint-disable-line new-cap
-
- Client.getChannels(
- (data) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_CHANNELS,
- channels: data.channels,
- members: data.members
- });
-
- d1.resolve();
- },
- (err) => {
- AsyncClient.dispatchError(err, 'getChannels');
- d1.resolve();
- }
- );
-
- Client.getProfiles(
- (data) => {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_PROFILES,
- profiles: data
- });
-
- d2.resolve();
- },
- (err) => {
- AsyncClient.dispatchError(err, 'getProfiles');
- d2.resolve();
- }
- );
-
- $.when(d1, d2).done(() => {
- callback();
- });
-}
-
-function onPermalinkEnter(nextState) {
- const postId = nextState.params.postid;
- GlobalActions.emitPostFocusEvent(postId);
-}
-
-function onChannelEnter(nextState, replace, callback) {
- doChannelChange(nextState, replace, callback);
-}
-
-function doChannelChange(state, replace, callback) {
- let channel;
- if (state.location.query.fakechannel) {
- channel = JSON.parse(state.location.query.fakechannel);
- } else {
- channel = ChannelStore.getByName(state.params.channel);
- if (!channel) {
- channel = ChannelStore.getMoreByName(state.params.channel);
- }
- if (!channel) {
- Client.joinChannelByName(
- state.params.channel,
- (data) => {
- GlobalActions.emitChannelClickEvent(data);
- callback();
- },
- () => {
- if (state.params.team) {
- replace('/' + state.params.team + '/channels/town-square');
- } else {
- replace('/');
- }
- callback();
- }
- );
- return;
- }
- }
- GlobalActions.emitChannelClickEvent(channel);
- callback();
-}
-
function renderRootComponent() {
ReactDOM.render((
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ routes={rRoot}
+ />
),
document.getElementById('root'));
}
diff --git a/webapp/routes/route_admin_console.jsx b/webapp/routes/route_admin_console.jsx
new file mode 100644
index 0000000000..cd1144ae62
--- /dev/null
+++ b/webapp/routes/route_admin_console.jsx
@@ -0,0 +1,207 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as RouteUtils from 'routes/route_utils.jsx';
+import {Route, Redirect, IndexRedirect} from 'react-router/es6';
+import React from 'react';
+
+import SystemAnalytics from 'components/analytics/system_analytics.jsx';
+import ConfigurationSettings from 'components/admin_console/configuration_settings.jsx';
+import LocalizationSettings from 'components/admin_console/localization_settings.jsx';
+import UsersAndTeamsSettings from 'components/admin_console/users_and_teams_settings.jsx';
+import PrivacySettings from 'components/admin_console/privacy_settings.jsx';
+import LogSettings from 'components/admin_console/log_settings.jsx';
+import EmailAuthenticationSettings from 'components/admin_console/email_authentication_settings.jsx';
+import GitLabSettings from 'components/admin_console/gitlab_settings.jsx';
+import LdapSettings from 'components/admin_console/ldap_settings.jsx';
+import SignupSettings from 'components/admin_console/signup_settings.jsx';
+import LoginSettings from 'components/admin_console/login_settings.jsx';
+import PublicLinkSettings from 'components/admin_console/public_link_settings.jsx';
+import SessionSettings from 'components/admin_console/session_settings.jsx';
+import ConnectionSettings from 'components/admin_console/connection_settings.jsx';
+import EmailSettings from 'components/admin_console/email_settings.jsx';
+import PushSettings from 'components/admin_console/push_settings.jsx';
+import WebhookSettings from 'components/admin_console/webhook_settings.jsx';
+import ExternalServiceSettings from 'components/admin_console/external_service_settings.jsx';
+import DatabaseSettings from 'components/admin_console/database_settings.jsx';
+import StorageSettings from 'components/admin_console/storage_settings.jsx';
+import ImageSettings from 'components/admin_console/image_settings.jsx';
+import CustomBrandSettings from 'components/admin_console/custom_brand_settings.jsx';
+import CustomEmojiSettings from 'components/admin_console/custom_emoji_settings.jsx';
+import LegalAndSupportSettings from 'components/admin_console/legal_and_support_settings.jsx';
+import ComplianceSettings from 'components/admin_console/compliance_settings.jsx';
+import RateSettings from 'components/admin_console/rate_settings.jsx';
+import DeveloperSettings from 'components/admin_console/developer_settings.jsx';
+import TeamUsers from 'components/admin_console/team_users.jsx';
+import TeamAnalytics from 'components/analytics/team_analytics.jsx';
+import LicenseSettings from 'components/admin_console/license_settings.jsx';
+import Audits from 'components/admin_console/audits.jsx';
+import Logs from 'components/admin_console/logs.jsx';
+
+export default (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+);
diff --git a/webapp/routes/route_claim.jsx b/webapp/routes/route_claim.jsx
new file mode 100644
index 0000000000..02dfeb8e84
--- /dev/null
+++ b/webapp/routes/route_claim.jsx
@@ -0,0 +1,36 @@
+import * as RouteUtils from 'routes/route_utils.jsx';
+
+export default {
+ path: 'claim',
+ getComponents: (location, callback) => {
+ System.import('components/claim/claim_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'oauth_to_email',
+ getComponents: (location, callback) => {
+ System.import('components/claim/components/oauth_to_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'email_to_oauth',
+ getComponents: (location, callback) => {
+ System.import('components/claim/components/email_to_oauth.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'ldap_to_email',
+ getComponents: (location, callback) => {
+ System.import('components/claim/components/ldap_to_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'email_to_ldap',
+ getComponents: (location, callback) => {
+ System.import('components/claim/components/email_to_ldap.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ }
+ ]
+ )
+};
diff --git a/webapp/routes/route_create_team.jsx b/webapp/routes/route_create_team.jsx
new file mode 100644
index 0000000000..354d7a39ce
--- /dev/null
+++ b/webapp/routes/route_create_team.jsx
@@ -0,0 +1,25 @@
+import * as RouteUtils from 'routes/route_utils.jsx';
+
+export default {
+ path: 'create_team',
+ getComponents: (location, callback) => {
+ System.import('components/create_team/create_team_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ indexRoute: {onEnter: (nextState, replace) => replace('/create_team/display_name')},
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'display_name',
+ getComponents: (location, callback) => {
+ System.import('components/create_team/components/display_name.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'team_url',
+ getComponents: (location, callback) => {
+ System.import('components/create_team/components/team_url.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ }
+ ]
+ )
+};
diff --git a/webapp/routes/route_integrations.jsx b/webapp/routes/route_integrations.jsx
new file mode 100644
index 0000000000..6ebd09a728
--- /dev/null
+++ b/webapp/routes/route_integrations.jsx
@@ -0,0 +1,84 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as RouteUtils from 'routes/route_utils.jsx';
+import {Route, IndexRoute, Redirect} from 'react-router/es6';
+import React from 'react';
+
+import BackstageNavbar from 'components/backstage/backstage_navbar.jsx';
+import BackstageSidebar from 'components/backstage/backstage_sidebar.jsx';
+import Integrations from 'components/backstage/integrations.jsx';
+import InstalledIncomingWebhooks from 'components/backstage/installed_incoming_webhooks.jsx';
+import InstalledOutgoingWebhooks from 'components/backstage/installed_outgoing_webhooks.jsx';
+import InstalledCommands from 'components/backstage/installed_commands.jsx';
+import AddIncomingWebhook from 'components/backstage/add_incoming_webhook.jsx';
+import AddOutgoingWebhook from 'components/backstage/add_outgoing_webhook.jsx';
+import AddCommand from 'components/backstage/add_command.jsx';
+
+export default (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+);
diff --git a/webapp/routes/route_root.jsx b/webapp/routes/route_root.jsx
new file mode 100644
index 0000000000..6593e2bd83
--- /dev/null
+++ b/webapp/routes/route_root.jsx
@@ -0,0 +1,123 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as RouteUtils from 'routes/route_utils.jsx';
+
+import Root from 'components/root.jsx';
+
+import claimAccountRoute from 'routes/route_claim.jsx';
+import createTeamRoute from 'routes/route_create_team.jsx';
+import teamRoute from 'routes/route_team.jsx';
+
+import ErrorStore from 'stores/error_store.jsx';
+function preLoggedIn(nextState, replace, callback) {
+ ErrorStore.clearLastError();
+ callback();
+}
+
+export default {
+ path: '/',
+ component: Root,
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ getComponents: (location, callback) => {
+ System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'login',
+ getComponents: (location, callback) => {
+ System.import('components/login/login_controller.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'reset_password',
+ getComponents: (location, callback) => {
+ System.import('components/password_reset_send_link.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'reset_password_complete',
+ getComponents: (location, callback) => {
+ System.import('components/password_reset_form.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ claimAccountRoute,
+ {
+ path: 'signup_user_complete',
+ getComponents: (location, callback) => {
+ System.import('components/signup_user_complete.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'should_verify_email',
+ getComponents: (location, callback) => {
+ System.import('components/should_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ path: 'do_verify_email',
+ getComponents: (location, callback) => {
+ System.import('components/do_verify_email.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ }
+ ]
+ )
+ },
+ {
+ path: 'error',
+ getComponents: (location, callback) => {
+ System.import('components/error_page.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ {
+ getComponents: (location, callback) => {
+ System.import('components/logged_in.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ onEnter: preLoggedIn,
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'admin_console',
+ getComponents: (location, callback) => {
+ System.import('components/admin_console/admin_console.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ indexRoute: {onEnter: (nextState, replace) => replace('/admin_console/system_analytics')},
+ getChildRoutes: (location, callback) => {
+ System.import('routes/route_admin_console.jsx').then((comp) => callback(null, comp.default));
+ }
+ },
+ {
+ getComponents: (location, callback) => {
+ System.import('components/header_footer_template.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ getChildRoutes: RouteUtils.createGetChildComponentsFunction(
+ [
+ {
+ path: 'select_team',
+ getComponents: (location, callback) => {
+ System.import('components/select_team/select_team.jsx').then(RouteUtils.importComponentSuccess(callback));
+ }
+ },
+ createTeamRoute
+ ]
+ )
+ },
+ teamRoute
+ ]
+ )
+ },
+ {
+ path: '*',
+ onEnter: (nextState, replace) => {
+ replace({
+ pathname: 'error',
+ query: RouteUtils.notFoundParams
+ });
+ }
+ }
+ ]
+ )
+};
diff --git a/webapp/routes/route_team.jsx b/webapp/routes/route_team.jsx
new file mode 100644
index 0000000000..7025ecb999
--- /dev/null
+++ b/webapp/routes/route_team.jsx
@@ -0,0 +1,171 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import $ from 'jquery';
+import * as RouteUtils from 'routes/route_utils.jsx';
+import {browserHistory} from 'react-router/es6';
+
+import TeamStore from 'stores/team_store.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
+import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
+import Constants from 'utils/constants.jsx';
+const ActionTypes = Constants.ActionTypes;
+import * as AsyncClient from 'utils/async_client.jsx';
+import Client from 'utils/web_client.jsx';
+import * as Utils from 'utils/utils.jsx';
+import ChannelStore from 'stores/channel_store.jsx';
+
+function onChannelEnter(nextState, replace, callback) {
+ doChannelChange(nextState, replace, callback);
+}
+
+function doChannelChange(state, replace, callback) {
+ let channel;
+ if (state.location.query.fakechannel) {
+ channel = JSON.parse(state.location.query.fakechannel);
+ } else {
+ channel = ChannelStore.getByName(state.params.channel);
+ if (!channel) {
+ channel = ChannelStore.getMoreByName(state.params.channel);
+ }
+ if (!channel) {
+ Client.joinChannelByName(
+ state.params.channel,
+ (data) => {
+ GlobalActions.emitChannelClickEvent(data);
+ callback();
+ },
+ () => {
+ if (state.params.team) {
+ replace('/' + state.params.team + '/channels/town-square');
+ } else {
+ replace('/');
+ }
+ callback();
+ }
+ );
+ return;
+ }
+ }
+ GlobalActions.emitChannelClickEvent(channel);
+ callback();
+}
+
+function preNeedsTeam(nextState, replace, callback) {
+ // First check to make sure you're in the current team
+ // for the current url.
+ var teamName = Utils.getTeamNameFromUrl();
+ var team = TeamStore.getByName(teamName);
+ const oldTeamId = TeamStore.getCurrentId();
+
+ if (!team) {
+ browserHistory.push('/');
+ return;
+ }
+
+ GlobalActions.emitCloseRightHandSide();
+
+ TeamStore.saveMyTeam(team);
+ TeamStore.emitChange();
+
+ // If the old team id is null then we will already have the direct
+ // profiles from initial load
+ if (oldTeamId != null) {
+ AsyncClient.getDirectProfiles();
+ }
+
+ var d1 = $.Deferred(); //eslint-disable-line new-cap
+ var d2 = $.Deferred(); //eslint-disable-line new-cap
+
+ Client.getChannels(
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_CHANNELS,
+ channels: data.channels,
+ members: data.members
+ });
+
+ d1.resolve();
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getChannels');
+ d1.resolve();
+ }
+ );
+
+ Client.getProfiles(
+ (data) => {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_PROFILES,
+ profiles: data
+ });
+
+ d2.resolve();
+ },
+ (err) => {
+ AsyncClient.dispatchError(err, 'getProfiles');
+ d2.resolve();
+ }
+ );
+
+ $.when(d1, d2).done(() => {
+ callback();
+ });
+}
+
+function onPermalinkEnter(nextState) {
+ const postId = nextState.params.postid;
+ GlobalActions.emitPostFocusEvent(postId);
+}
+
+export default {
+ path: ':team',
+ getComponents: (location, callback) => {
+ System.import('components/needs_team.jsx').then(RouteUtils.importComponentSuccess(callback));
+ },
+ onEnter: preNeedsTeam,
+ indexRoute: {onEnter: (nextState, replace) => replace('/' + nextState.params.team + '/channels/town-square')},
+ childRoutes: [
+ {
+ path: 'channels/:channel',
+ onEnter: onChannelEnter,
+ getComponents: (location, callback) => {
+ Promise.all([
+ System.import('components/sidebar.jsx'),
+ System.import('components/channel_view.jsx')
+ ]).then(
+ (comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
+ );
+ }
+ },
+ {
+ path: 'pl/:postid',
+ onEnter: onPermalinkEnter,
+ getComponents: (location, callback) => {
+ Promise.all([
+ System.import('components/sidebar.jsx'),
+ System.import('components/permalink_view.jsx')
+ ]).then(
+ (comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
+ );
+ }
+ },
+ {
+ path: 'tutorial',
+ getComponents: (location, callback) => {
+ Promise.all([
+ System.import('components/sidebar.jsx'),
+ System.import('components/tutorial/tutorial_view.jsx')
+ ]).then(
+ (comarr) => callback(null, {sidebar: comarr[0].default, center: comarr[1].default})
+ );
+ }
+ },
+ {
+ path: 'settings',
+ getChildRoutes: (location, callback) => {
+ System.import('routes/route_integrations.jsx').then((comp) => callback(null, [comp.default]));
+ }
+ }
+ ]
+};
diff --git a/webapp/routes/route_utils.jsx b/webapp/routes/route_utils.jsx
new file mode 100644
index 0000000000..f3a159cbc8
--- /dev/null
+++ b/webapp/routes/route_utils.jsx
@@ -0,0 +1,20 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import * as Utils from 'utils/utils.jsx';
+
+export function importComponentSuccess(callback) {
+ return (comp) => callback(null, comp.default);
+}
+
+export function createGetChildComponentsFunction(arrayOfComponents) {
+ return (locaiton, callback) => callback(null, arrayOfComponents);
+}
+
+export const notFoundParams = {
+ title: Utils.localizeMessage('error.not_found.title', 'Page not found'),
+ message: Utils.localizeMessage('error.not_found.message', 'The page you were trying to reach does not exist'),
+ link: '/',
+ linkmessage: Utils.localizeMessage('error.not_found.link_message', 'Back to Mattermost')
+};
+
diff --git a/webapp/stores/browser_store.jsx b/webapp/stores/browser_store.jsx
index 6be2dc8f30..f19e5b9a1c 100644
--- a/webapp/stores/browser_store.jsx
+++ b/webapp/stores/browser_store.jsx
@@ -1,7 +1,7 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import * as Utils from 'utils/utils.jsx';
const notSupportedParams = {
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index cc4a24d196..dbf18d7220 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -2,7 +2,7 @@
// See License.txt for license information.
import Autolinker from 'autolinker';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import Constants from './constants.jsx';
import * as Emoticons from './emoticons.jsx';
import * as Markdown from './markdown.jsx';
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 003f6025d9..88d7616dee 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -13,7 +13,7 @@ var ActionTypes = Constants.ActionTypes;
import * as AsyncClient from './async_client.jsx';
import Client from './web_client.jsx';
-import {browserHistory} from 'react-router';
+import {browserHistory} from 'react-router/es6';
import icon50 from 'images/icon50x50.png';
import bing from 'images/bing.mp3';
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index 191518a079..aaadb9de54 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -105,7 +105,13 @@ var config = {
'process.env': {
NODE_ENV: JSON.stringify('production')
}
+ }),
+ new webpack.optimize.CommonsChunkPlugin({
+ minChunks: 2,
+ children: true,
+ name: 'main'
})
+ //new webpack.optimize.AggressiveMergingPlugin()
],
resolve: {
alias: {
@@ -144,9 +150,6 @@ if (!DEV) {
comments: false
})
);
- config.plugins.push(
- new webpack.optimize.AggressiveMergingPlugin()
- );
config.plugins.push(
new webpack.optimize.OccurrenceOrderPlugin(true)
);