角延迟加载-看不到它正在工作

dan*_*nda 0 javascript lazy-loading typescript angular

我定义了一个延迟加载模块。

这是SettingsRoutingModule模块-

 const routes: Routes = [
        {
            path: '',
            component: SettingsStandaloneComponent,
            children: [
                {
                    path: '',
                    redirectTo: 'profile',
                    pathMatch: 'full'
                },
                {
                    path: 'profile',
                    component: SettingsProfileComponent
                },
                {
                    path: 'about',
                    component: SettingsAboutComponent
                },
                {
                    path: 'affiliations',
                    component: SettingsAffiliationsComponent
                },
                {
                    path: 'communication',
                    component: SettingsCommunicationComponent
                },
                {
                    path: 'notifications',
                    component: SettingsNotificationsComponent
                },
                {
                    path: 'proxies',
                    component: SettingsProxiesComponent
                },
                {
                    path: '**',
                    redirectTo: 'profile',
                    pathMatch: 'full'
                }
            ]
        }
    ];

    @NgModule({
        imports: [RouterModule.forChild(routes)],
        exports: [RouterModule]
    })
    export class SettingsRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

在AppRoutingModule模块中-

{ path: 'settings',
    loadChildren: './settings/settings.module#SettingsModule',
    canActivate: [AuthGuard],
},
Run Code Online (Sandbox Code Playgroud)

在生产环境中进入网络时,我看不到每个人都应该出现的“ chunk.js”。“只有两个看起来像的文件-0.34016a93d44e785b623a.js

在我的本地主机中,我仅看到“ settings-settings-module.js”

可以,还是意味着我的模块不是很懒?

Kir*_*aAG 5

由于"namedChunks": false您在angular.json中使用了此选项,因此您将不再看到已命名的块,而是将哈希值显示为文件名。这是由于最近对角度/ cli进行了改进(不确定从何时开始)。