close

[Solved] Getting ‘Cannot read property ‘ɵmod’ of undefined’ when importing custom module

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Getting ‘Cannot read property ‘ɵmod’ of undefined’ when importing custom module in AngularJS. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How To Solve Getting ‘Cannot read property ‘ɵmod’ of undefined’ when importing custom module Error?

  1. How To Solve Getting 'Cannot read property 'ɵmod' of undefined' when importing custom module Error?

    To Solve Getting 'Cannot read property 'ɵmod' of undefined' when importing custom module Error which worked for me in a previous project though didn't work this time. Now I have added return in “then”, and am getting the expected results

  2. Getting 'Cannot read property 'ɵmod' of undefined' when importing custom module

    To Solve Getting 'Cannot read property 'ɵmod' of undefined' when importing custom module Error which worked for me in a previous project though didn't work this time. Now I have added return in “then”, and am getting the expected results

Solution 1

Simply just return the module.

 {
    path: 'auth',
    loadChildren: () =>
      import('./auth/auth.module')
        .then((a) => {
          return a.AuthModule;
        });
  },

Solution 2

Same error here, im my case i changed the import declaration at my custom module: Before:

`import { BaseChartModule, SortModule } from '@pure-components';`

Changed to:

import { BaseChartModule } from '../base-chart/base-chart.module';

I will investigate why this happens but worked fine for me, I hope that helpful

Solution 3

I was doing it this way

{
 path: 'doctor',
 loadChildren: () => 
   import('./doctor/doctor.module')
   .then((m) => {m.DoctorModule;})
}

which worked for me in a previous project though didn’t work this time. Now I have added return in “then”, and am getting the expected results

{
  path: 'doctor',
  loadChildren: () =>
    import('./doctor/doctor.module')
    .then((m) => {
      return m.DoctorModule;
    })
},

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment