Open luozt opened 7 years ago
我在做一个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
EXCEPTION: Uncaught (in promise): TypeError: undefined is not a function
是因为require中没有ensure的方法,这个是webpack的语法。
require
ensure
请问,这里要怎么配置才使得fis3也支持这个require.ensure呢?还是或我上面的路由写法要改下?
require.ensure
用require.async ?
require.async
我在做一个angular2的应用,通过fis3来编译,其中定义路由是这样写的:
然后会报
EXCEPTION: Uncaught (in promise): TypeError: undefined is not a function
是因为
require
中没有ensure
的方法,这个是webpack的语法。请问,这里要怎么配置才使得fis3也支持这个
require.ensure
呢?还是或我上面的路由写法要改下?