Angular lazyloaded component error Error: Cannot find 'default'

I have deployed an angular app via azure devops in production mode. But when want to go any lazyloaded component it give the error

    ERROR Error: Uncaught (in promise): Error: Cannot find 'default' in 
    './problem/problem.module'
    Error: Cannot find 'default' in './problem/problem.module'

Note that if i reload any page without index.html it gives error:

    The resource you are looking for has been removed, had its name 
    changed, or is temporarily unavailable.

the website is :https://tritronfront.azurewebsites.net/ To produce the error you have to click on problem menu on navbar.

My lazy loading route code is

    { path: 'admin', loadChildren: './admin/admin.module'},
    { path: 'problem', loadChildren: './problem/problem.module'}

and module code is

    export default class ProblemModule { }

Upvotes: 0

Views: 88

Answers (1)

Ajay Reddy
Ajay Reddy

Reputation: 1493

just say:

export class ProblemModule { }

you have to also add one more thing:

{ path: 'problem', loadChildren: './problem/problem.module#ProblemModule'}

This is there in the official documentation https://angular.io/docs/ts/latest/guide/router.html

Upvotes: 2

Related Questions