I have an angular application where i use lazy loading for one of its module named 'security', i mentioned in routes array of app.routing.module.ts
const routes: Routes = [
{path:'path1',component:Path1Component},
{path:'smotherRoute',component:SmOtherRouteComponent},
{ path: 'security', loadChildren: () => import('./components/security/security.module').then(m => m.SecurityModule) },
]
The folder structure is
src/app/components/security
src/app/components/smotherRoute
src/app/components/...
the security module has routing.modules.ts and module.ts, component.ts, component.html
src/app/components/security/security.component.ts
src/app/components/security/security.component.html
src/app/components/security/security.module.ts
src/app/components/security/security.routing.ts
In security.component.html
<router-outlet></router-outlet>
The routing module of security is imported in security.module.ts
Imports :[ SecurityRoutingModule,]
The routes for security modules are been mentioned in security.routing.module.ts
const routes: Routes = [{ path: '', component: SecurityComponent , children: [
{path: 'child1', component: Child1Component},
{path: 'child2', component: Child2Component}]
when i try to access the app security module through browser, it threw an error like below:
Run time compiler failed to load
or
loading chunk1 or chunk3 failed
However this works using npm run serve /ng serve commands, these errors are seen only when tried to use 'npm run build:single-spa'. ( BTW , i am using single-spa library .)