fex-team/fis3-hook-node_modules

fis3有类似webpack的require.ensure的方法吗

Opened this issue · 1 comments

luozt commented

我在做一个angular2的应用,通过fis3来编译,其中定义路由是这样写的:

export const ROUTES: Routes = [
  { path: '',      component: PgHomeComponent },
  { path: 'home',  component: PgHomeComponent },
  { path: 'login',  component: PgLoginComponent },
  { path: 'detail', loadChildren: function(){
    return new Promise(function (resolve) {
      (require as any).ensure([''], (require: any)=>{
        resolve(require('./pages/pg-detail').PgDetailModule);
      });
    });
  }},
  { path: '**',    component: Pg404Component },
];

然后会报EXCEPTION: Uncaught (in promise): TypeError: undefined is not a function

是因为require中没有ensure的方法,这个是webpack的语法。

请问,这里要怎么配置才使得fis3也支持这个require.ensure呢?还是或我上面的路由写法要改下?

require.async ?