import angular from 'angular'import 'angular-ui-router'import 'oclazyload'import 'bootstrap/dist/css/bootstrap.min.css'import AppComponent from './app.component'angular.module('app', [ 'ui.router', 'oc.lazyLoad',]) .config(($stateProvider, $urlRouterProvider) => { $urlRouterProvider.otherwise('/') $stateProvider.state('search', { url: '/search', component: 'searchpageComponent', lazyLoad:function($q, $ocLazyLoad) { let deferred = $q.defer() require.ensure(['./searchPage/searchpage.js'], function() { let module = require('./searchPage/searchpage.js') $ocLazyLoad.load({ name: 'searchPage' }) deferred.resolve(module) }) return deferred.promise } }) }) .component('appCom', AppComponent)