diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-07-18 15:11:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 15:11:50 +0200 |
commit | f42aaaa98952fa997665dfbe29515eb993e67701 (patch) | |
tree | 871b4771a6354d5a2e52f20e82914eae2e1f2420 /server/sonar-web/src/main/js/apps | |
parent | f3c05bcc9a63fd20dafe0411490265103b599179 (diff) | |
download | sonarqube-f42aaaa98952fa997665dfbe29515eb993e67701.tar.gz sonarqube-f42aaaa98952fa997665dfbe29515eb993e67701.zip |
replace require.ensure with dymamic import (#2187)
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
27 files changed, 94 insertions, 174 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js b/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js index 5af2402c06e..8d22b8f8b43 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js @@ -29,11 +29,9 @@ export default class AboutAppForSonarQubeDotComLazyLoader extends React.PureComp componentDidMount() { if (!this.state.AboutAppForSonarQubeDotCom) { - require.ensure([], require => { - this.setState({ - AboutAppForSonarQubeDotCom: require('./AboutAppForSonarQubeDotCom').default - }); - }); + import('./AboutAppForSonarQubeDotCom').then(({ default: AboutAppForSonarQubeDotCom }) => + this.setState({ AboutAppForSonarQubeDotCom }) + ); } } diff --git a/server/sonar-web/src/main/js/apps/about/routes.js b/server/sonar-web/src/main/js/apps/about/routes.js index 233b7e289ac..0748dad497d 100644 --- a/server/sonar-web/src/main/js/apps/about/routes.js +++ b/server/sonar-web/src/main/js/apps/about/routes.js @@ -20,9 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/AboutApp').default }) - ); + import('./components/AboutApp').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/account/routes.js b/server/sonar-web/src/main/js/apps/account/routes.js index 43cd438d7b0..2b92bf00f6b 100644 --- a/server/sonar-web/src/main/js/apps/account/routes.js +++ b/server/sonar-web/src/main/js/apps/account/routes.js @@ -20,52 +20,42 @@ const routes = [ { getComponent(_, callback) { - require.ensure([], require => callback(null, require('./components/Account').default)); + import('./components/Account').then(i => callback(null, i.default)); }, childRoutes: [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./profile/Profile').default }) - ); + import('./profile/Profile').then(i => callback(null, { component: i.default })); } }, { path: 'security', getComponent(_, callback) { - require.ensure([], require => callback(null, require('./components/Security').default)); + import('./components/Security').then(i => callback(null, i.default)); } }, { path: 'projects', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./projects/ProjectsContainer').default) - ); + import('./projects/ProjectsContainer').then(i => callback(null, i.default)); } }, { path: 'notifications', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./notifications/Notifications').default) - ); + import('./notifications/Notifications').then(i => callback(null, i.default)); } }, { path: 'organizations', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./organizations/UserOrganizations').default) - ); + import('./organizations/UserOrganizations').then(i => callback(null, i.default)); }, childRoutes: [ { path: 'create', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./organizations/CreateOrganizationForm').default) - ); + import('./organizations/CreateOrganizationForm').then(i => callback(null, i.default)); } } ] diff --git a/server/sonar-web/src/main/js/apps/background-tasks/routes.js b/server/sonar-web/src/main/js/apps/background-tasks/routes.js index bdc399c3b33..3f46e626d9e 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/routes.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/routes.js @@ -20,9 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/BackgroundTasksApp').default }) - ); + import('./components/BackgroundTasksApp').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/code/routes.js b/server/sonar-web/src/main/js/apps/code/routes.js index 73a48b7b9c3..4de41657b76 100644 --- a/server/sonar-web/src/main/js/apps/code/routes.js +++ b/server/sonar-web/src/main/js/apps/code/routes.js @@ -20,9 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/App').default }) - ); + import('./components/App').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/routes.js b/server/sonar-web/src/main/js/apps/coding-rules/routes.js index a1bba34c6b6..af91a4eab6d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/routes.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/routes.js @@ -21,9 +21,7 @@ const routes = [ { indexRoute: { getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./components/CodingRulesAppContainer').default); - }); + import('./components/CodingRulesAppContainer').then(i => callback(null, i.default)); } } } diff --git a/server/sonar-web/src/main/js/apps/component-measures/routes.js b/server/sonar-web/src/main/js/apps/component-measures/routes.js index c4b1fb5162d..0c4f83db5e1 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/routes.js +++ b/server/sonar-web/src/main/js/apps/component-measures/routes.js @@ -20,27 +20,25 @@ const routes = [ { getComponent(_, callback) { - require.ensure([], require => callback(null, require('./app/AppContainer').default)); + import('./app/AppContainer').then(i => callback(null, i.default)); }, childRoutes: [ { getComponent(_, callback) { - require.ensure([], require => callback(null, require('./home/HomeContainer').default)); + import('./home/HomeContainer').then(i => callback(null, i.default)); }, childRoutes: [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./home/AllMeasuresContainer').default }) + import('./home/AllMeasuresContainer').then(i => + callback(null, { component: i.default }) ); } }, { path: 'domain/:domainName', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./home/DomainMeasuresContainer').default) - ); + import('./home/DomainMeasuresContainer').then(i => callback(null, i.default)); } } ] @@ -48,9 +46,7 @@ const routes = [ { path: 'metric/:metricKey', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./details/MeasureDetailsContainer').default) - ); + import('./details/MeasureDetailsContainer').then(i => callback(null, i.default)); }, childRoutes: [ { @@ -67,17 +63,13 @@ const routes = [ { path: 'list', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./details/drilldown/ListViewContainer').default) - ); + import('./details/drilldown/ListViewContainer').then(i => callback(null, i.default)); } }, { path: 'tree', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./details/drilldown/TreeViewContainer').default) - ); + import('./details/drilldown/TreeViewContainer').then(i => callback(null, i.default)); } }, { @@ -96,8 +88,8 @@ const routes = [ { path: 'treemap', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./details/treemap/MeasureTreemapContainer').default) + import('./details/treemap/MeasureTreemapContainer').then(i => + callback(null, i.default) ); } } diff --git a/server/sonar-web/src/main/js/apps/component/routes.js b/server/sonar-web/src/main/js/apps/component/routes.js index edb7d77a7f2..9943b1d8380 100644 --- a/server/sonar-web/src/main/js/apps/component/routes.js +++ b/server/sonar-web/src/main/js/apps/component/routes.js @@ -21,7 +21,7 @@ const routes = [ { indexRoute: { getComponent(_, callback) { - require.ensure([], require => callback(null, require('./components/App').default)); + import('./components/App').then(i => callback(null, i.default)); } } } diff --git a/server/sonar-web/src/main/js/apps/custom-measures/routes.js b/server/sonar-web/src/main/js/apps/custom-measures/routes.js index f4e98ca2c3a..e3aee2038cd 100644 --- a/server/sonar-web/src/main/js/apps/custom-measures/routes.js +++ b/server/sonar-web/src/main/js/apps/custom-measures/routes.js @@ -20,8 +20,8 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/CustomMeasuresAppContainer').default }) + import('./components/CustomMeasuresAppContainer').then(i => + callback(null, { component: i.default }) ); } } diff --git a/server/sonar-web/src/main/js/apps/groups/routes.js b/server/sonar-web/src/main/js/apps/groups/routes.js index d161da9d9fe..8829f80c94b 100644 --- a/server/sonar-web/src/main/js/apps/groups/routes.js +++ b/server/sonar-web/src/main/js/apps/groups/routes.js @@ -20,12 +20,12 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => { - const GroupsAppContainer = require('./components/GroupsAppContainer').default; - const forSingleOrganization = require('../organizations/forSingleOrganization').default; - const component = forSingleOrganization(GroupsAppContainer); - callback(null, { component }); - }); + Promise.all([ + import('./components/GroupsAppContainer').then(i => i.default), + import('../organizations/forSingleOrganization').then(i => i.default) + ]).then(([GroupsAppContainer, forSingleOrganization]) => + callback(null, { component: forSingleOrganization(GroupsAppContainer) }) + ); } } ]; diff --git a/server/sonar-web/src/main/js/apps/issues/routes.js b/server/sonar-web/src/main/js/apps/issues/routes.js index f4c372a1368..ffcdcb7a090 100644 --- a/server/sonar-web/src/main/js/apps/issues/routes.js +++ b/server/sonar-web/src/main/js/apps/issues/routes.js @@ -22,11 +22,8 @@ import { onEnter } from './redirects'; const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { - component: require('./components/AppContainer').default, - onEnter - }) + import('./components/AppContainer').then(i => + callback(null, { component: i.default, onEnter }) ); } } diff --git a/server/sonar-web/src/main/js/apps/metrics/routes.js b/server/sonar-web/src/main/js/apps/metrics/routes.js index 6cbe20ddab9..637dba72da9 100644 --- a/server/sonar-web/src/main/js/apps/metrics/routes.js +++ b/server/sonar-web/src/main/js/apps/metrics/routes.js @@ -20,8 +20,8 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/MetricsAppContainer').default }) + import('./components/MetricsAppContainer').then(i => + callback(null, { component: i.default }) ); } } diff --git a/server/sonar-web/src/main/js/apps/overview/routes.js b/server/sonar-web/src/main/js/apps/overview/routes.js index 7af0479bb25..02a7323043e 100644 --- a/server/sonar-web/src/main/js/apps/overview/routes.js +++ b/server/sonar-web/src/main/js/apps/overview/routes.js @@ -20,9 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/AppContainer').default }) - ); + import('./components/AppContainer').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/routes.js b/server/sonar-web/src/main/js/apps/permission-templates/routes.js index d44e8735ad3..ce1b2679e4a 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/routes.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/routes.js @@ -20,12 +20,12 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => { - const AppContainer = require('./components/AppContainer').default; - const forSingleOrganization = require('../organizations/forSingleOrganization').default; - const component = forSingleOrganization(AppContainer); - callback(null, { component }); - }); + Promise.all([ + import('./components/AppContainer').then(i => i.default), + import('../organizations/forSingleOrganization').then(i => i.default) + ]).then(([AppContainer, forSingleOrganization]) => + callback(null, { component: forSingleOrganization(AppContainer) }) + ); } } ]; diff --git a/server/sonar-web/src/main/js/apps/permissions/routes.js b/server/sonar-web/src/main/js/apps/permissions/routes.js index 71a6d7aba3a..631a26985b1 100644 --- a/server/sonar-web/src/main/js/apps/permissions/routes.js +++ b/server/sonar-web/src/main/js/apps/permissions/routes.js @@ -20,12 +20,12 @@ export const globalPermissionsRoutes = [ { getIndexRoute(_, callback) { - require.ensure([], require => { - const GlobalPermissionsApp = require('./global/components/App').default; - const forSingleOrganization = require('../organizations/forSingleOrganization').default; - const component = forSingleOrganization(GlobalPermissionsApp); - callback(null, { component }); - }); + Promise.all([ + import('./global/components/App').then(i => i.default), + import('../organizations/forSingleOrganization').then(i => i.default) + ]).then(([App, forSingleOrganization]) => + callback(null, { component: forSingleOrganization(App) }) + ); } } ]; @@ -33,8 +33,8 @@ export const globalPermissionsRoutes = [ export const projectPermissionsRoutes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./project/components/AppContainer').default }) + import('./project/components/AppContainer').then(i => + callback(null, { component: i.default }) ); } } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/routes.js b/server/sonar-web/src/main/js/apps/projectActivity/routes.js index e11d7fbe8b4..11233a7368b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/routes.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/routes.js @@ -20,8 +20,8 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/ProjectActivityAppContainer').default }) + import('./components/ProjectActivityAppContainer').then(i => + callback(null, { component: i.default }) ); } } diff --git a/server/sonar-web/src/main/js/apps/projects-admin/routes.js b/server/sonar-web/src/main/js/apps/projects-admin/routes.js index 6ca2206f863..d17958371b6 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/routes.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/routes.js @@ -20,12 +20,12 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => { - const AppContainer = require('./AppContainer').default; - const forSingleOrganization = require('../organizations/forSingleOrganization').default; - const component = forSingleOrganization(AppContainer); - callback(null, { component }); - }); + Promise.all([ + import('./AppContainer').then(i => i.default), + import('../organizations/forSingleOrganization').then(i => i.default) + ]).then(([AppContainer, forSingleOrganization]) => + callback(null, { component: forSingleOrganization(AppContainer) }) + ); } } ]; 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 8c67972c076..1c3c76cc3d4 100644 --- a/server/sonar-web/src/main/js/apps/projects/routes.js +++ b/server/sonar-web/src/main/js/apps/projects/routes.js @@ -22,13 +22,13 @@ import { saveAll } from '../../helpers/storage'; const routes = [ { getComponent(_, callback) { - require.ensure([], require => callback(null, require('./components/App').default)); + import('./components/App').then(i => callback(null, i.default)); }, childRoutes: [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/DefaultPageSelector').default }) + import('./components/DefaultPageSelector').then(i => + callback(null, { component: i.default }) ); } }, @@ -42,9 +42,7 @@ const routes = [ { path: 'favorite', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./components/FavoriteProjectsContainer').default) - ); + import('./components/FavoriteProjectsContainer').then(i => callback(null, i.default)); } } ] diff --git a/server/sonar-web/src/main/js/apps/quality-gates/routes.js b/server/sonar-web/src/main/js/apps/quality-gates/routes.js index 495278f0d0a..8664f1f39bb 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/routes.js +++ b/server/sonar-web/src/main/js/apps/quality-gates/routes.js @@ -20,24 +20,18 @@ const routes = [ { getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./containers/QualityGatesAppContainer').default) - ); + import('./containers/QualityGatesAppContainer').then(i => callback(null, i.default)); }, childRoutes: [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/Intro').default }) - ); + import('./components/Intro').then(i => callback(null, { component: i.default })); } }, { path: 'show/:id', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./containers/DetailsContainer').default) - ); + import('./containers/DetailsContainer').then(i => callback(null, i.default)); } } ] diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/routes.js b/server/sonar-web/src/main/js/apps/quality-profiles/routes.js index 4c53b80384f..1d7b96fe647 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/routes.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/routes.js @@ -22,51 +22,41 @@ import { withRouter } from 'react-router'; const routes = [ { getComponent(state, callback) { - require.ensure([], require => { - const AppContainer = require('./components/AppContainer').default; + import('./components/AppContainer').then(i => i.default).then(AppContainer => { if (state.params.organizationKey) { callback(null, AppContainer); } else { - const forSingleOrganization = require('../organizations/forSingleOrganization').default; - callback(null, forSingleOrganization(AppContainer)); + import('../organizations/forSingleOrganization') + .then(i => i.default) + .then(forSingleOrganization => callback(null, forSingleOrganization(AppContainer))); } }); }, getIndexRoute(_, callback) { - require.ensure([], require => { - callback(null, { component: require('./home/HomeContainer').default }); - }); + import('./home/HomeContainer').then(i => callback(null, { component: i.default })); }, childRoutes: [ { getComponent(_, callback) { - require.ensure([], require => { - callback(null, withRouter(require('./components/ProfileContainer').default)); - }); + import('./components/ProfileContainer').then(i => callback(null, withRouter(i.default))); }, childRoutes: [ { path: 'show', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./details/ProfileDetails').default); - }); + import('./details/ProfileDetails').then(i => callback(null, i.default)); } }, { path: 'changelog', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./changelog/ChangelogContainer').default); - }); + import('./changelog/ChangelogContainer').then(i => callback(null, i.default)); } }, { path: 'compare', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./compare/ComparisonContainer').default); - }); + import('./compare/ComparisonContainer').then(i => callback(null, i.default)); } } ] diff --git a/server/sonar-web/src/main/js/apps/sessions/routes.js b/server/sonar-web/src/main/js/apps/sessions/routes.js index 957fb2a7207..32e367c391f 100644 --- a/server/sonar-web/src/main/js/apps/sessions/routes.js +++ b/server/sonar-web/src/main/js/apps/sessions/routes.js @@ -21,25 +21,19 @@ const routes = [ { path: 'new', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./components/LoginFormContainer').default); - }); + import('./components/LoginFormContainer').then(i => callback(null, i.default)); } }, { path: 'logout', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./components/Logout').default); - }); + import('./components/Logout').then(i => callback(null, i.default)); } }, { path: 'unauthorized', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./components/Unauthorized').default); - }); + import('./components/Unauthorized').then(i => callback(null, i.default)); } } ]; diff --git a/server/sonar-web/src/main/js/apps/settings/routes.js b/server/sonar-web/src/main/js/apps/settings/routes.js index 68300e6d2c8..9a408f19fe8 100644 --- a/server/sonar-web/src/main/js/apps/settings/routes.js +++ b/server/sonar-web/src/main/js/apps/settings/routes.js @@ -20,33 +20,25 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => { - callback(null, { component: require('./components/AppContainer').default }); - }); + import('./components/AppContainer').then(i => callback(null, { component: i.default })); } }, { path: 'licenses', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./licenses/LicensesApp').default); - }); + import('./licenses/LicensesApp').then(i => callback(null, i.default)); } }, { path: 'encryption', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./encryption/EncryptionAppContainer').default); - }); + import('./encryption/EncryptionAppContainer').then(i => callback(null, i.default)); } }, { path: 'server_id', getComponent(_, callback) { - require.ensure([], require => { - callback(null, require('./serverId/ServerIdAppContainer').default); - }); + import('./serverId/ServerIdAppContainer').then(i => callback(null, i.default)); } } ]; diff --git a/server/sonar-web/src/main/js/apps/system/routes.js b/server/sonar-web/src/main/js/apps/system/routes.js index 454ff5127fa..0ab080a46f4 100644 --- a/server/sonar-web/src/main/js/apps/system/routes.js +++ b/server/sonar-web/src/main/js/apps/system/routes.js @@ -20,7 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => callback(null, { component: require('./main').default })); + import('./main').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js index 7ae51334755..a402d0bdb58 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingModal.js @@ -37,10 +37,7 @@ export default class OnboardingModal extends React.PureComponent { componentDidMount() { this.mounted = true; - // $FlowFixMe - require.ensure([], require => { - this.receiveComponent(require('./OnboardingContainer').default); - }); + import('./OnboardingContainer').then(i => this.receiveComponent(i.default)); } componentWillUnmount() { diff --git a/server/sonar-web/src/main/js/apps/update-center/routes.js b/server/sonar-web/src/main/js/apps/update-center/routes.js index e4d9cb18015..81c884ae5d6 100644 --- a/server/sonar-web/src/main/js/apps/update-center/routes.js +++ b/server/sonar-web/src/main/js/apps/update-center/routes.js @@ -20,41 +20,33 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/UpdateCenterAppContainer').default }) + import('./components/UpdateCenterAppContainer').then(i => + callback(null, { component: i.default }) ); } }, { path: 'installed', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./components/UpdateCenterAppContainer').default) - ); + import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); } }, { path: 'updates', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./components/UpdateCenterAppContainer').default) - ); + import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); } }, { path: 'available', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./components/UpdateCenterAppContainer').default) - ); + import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); } }, { path: 'system', getComponent(_, callback) { - require.ensure([], require => - callback(null, require('./components/UpdateCenterAppContainer').default) - ); + import('./components/UpdateCenterAppContainer').then(i => callback(null, i.default)); } } ]; diff --git a/server/sonar-web/src/main/js/apps/users/routes.js b/server/sonar-web/src/main/js/apps/users/routes.js index e83f23c64b5..b07c3c9c5c2 100644 --- a/server/sonar-web/src/main/js/apps/users/routes.js +++ b/server/sonar-web/src/main/js/apps/users/routes.js @@ -20,9 +20,7 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/UsersAppContainer').default }) - ); + import('./components/UsersAppContainer').then(i => callback(null, { component: i.default })); } } ]; diff --git a/server/sonar-web/src/main/js/apps/web-api/routes.js b/server/sonar-web/src/main/js/apps/web-api/routes.js index a27df0a1e5c..5993b47eea4 100644 --- a/server/sonar-web/src/main/js/apps/web-api/routes.js +++ b/server/sonar-web/src/main/js/apps/web-api/routes.js @@ -20,15 +20,13 @@ const routes = [ { getIndexRoute(_, callback) { - require.ensure([], require => - callback(null, { component: require('./components/WebApiApp').default }) - ); + import('./components/WebApiApp').then(i => callback(null, { component: i.default })); } }, { path: '**', getComponent(_, callback) { - require.ensure([], require => callback(null, require('./components/WebApiApp').default)); + import('./components/WebApiApp').then(i => callback(null, i.default)); } } ]; |