Error: Cannot find module "." while importing custom data model


#1

Greetings, my problem is the following.
With Ionic 3 I started to implement lazy loading for all my pages. There is one page that is returning this error log:

ERROR Error: Uncaught (in promise): Error: Cannot find module “.”
Error: Cannot find module “.”
at webpackMissingModule (index.js:3)
at Array.concat.e.code (index.js:3)
at Object. (index.js:9)
at webpack_require (bootstrap bd92f535657e07097829:54)
at Object. (my-custom-model.ts:26)
at webpack_require (bootstrap bd92f535657e07097829:54)
at Object. (0.js:12)
at webpack_require (bootstrap bd92f535657e07097829:54)
at src lazy:124 […]

my-custom-model is a simple custom model which is defined like this:
export class MyCustomModel{
someAttribute: String;
constructor() {
}
}
This class is under “/src/datatypes”. I import this model from my pages like this:
import { MyCustomModel} from ‘…/…/datatypes/my-custom-model’;

Also, we instantiate objects from this class, so we do not use Interface type.

This code was working correctly before I changed to lazy loading. Do you know what could be wrong?
Should I import the model in the page module?
The only source I found about this was: https://github.com/JohnWeisz/TypedJSON/issues/57 . However, it is not the same case as I am not using this library.

I appreciate your time and help.

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android 6.4.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v6.10.2
npm               : 5.6.0

#2

The error had nothing to do with data models nor lazy loading.

The error was this: https://github.com/Microsoft/TypeScript/issues/25204 . My VS was adding the /umd to the IonicModule import which seems pretty harmless.


#3

I would go back to TypeScript 2.7.2 if I were you. Anything beyond that is unsupported not just with Ionic, but with the current state of angular-cli, last time I checked.