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
呢?还是或我上面的路由写法要改下?
younth commented
用require.async
?