From f42aaaa98952fa997665dfbe29515eb993e67701 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 18 Jul 2017 15:11:50 +0200 Subject: replace require.ensure with dymamic import (#2187) --- .../apps/about/components/AboutAppForSonarQubeDotComLazyLoader.js | 8 +++----- server/sonar-web/src/main/js/apps/about/routes.js | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'server/sonar-web/src/main/js/apps/about') 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 })); } } ]; -- cgit v1.2.3