Aot build, webpack missing module, cannot find module "."

When i add the --aot flag to my build i get the following error message in the console.
It used to work and I have been going through the code trying to find the culprit plugin or module, without luck so far.

Any help / insights are very much appreciated

[Error] Error: Cannot find module "."
	webpackMissingModule (vendor.js:127422:145)
	(anonymous function) (vendor.js:127422:148)
	(anonymous function) (vendor.js:127431)
	__webpack_require__ (vendor.js:55)
	(anonymous function) (main.js:10843)
	__webpack_require__ (vendor.js:55)
	webpackJsonpCallback (vendor.js:26)
	Global Code (main.js:1)

My package.json

{
    "name": "printix-app-user",
    "author": "Printix",
    "homepage": "http://iprintix.net/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "ionic:build": "ionic-app-scripts build",
        "ionic:watch": "ionic-app-scripts watch",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "5.2.6",
        "@angular/compiler": "5.2.6",
        "@angular/compiler-cli": "5.2.6",
        "@angular/core": "5.2.6",
        "@angular/forms": "5.2.6",
        "@angular/platform-browser": "5.2.6",
        "@angular/platform-browser-dynamic": "5.2.6",
        "@ionic-native/core": "4.20.0",
        "@ionic-native/device": "^4.18.0",
        "@ionic-native/in-app-browser": "4.5.3",
        "@ionic-native/ionic-webview": "^5.0.0-beta.20",
        "@ionic-native/keyboard": "4.5.3",
        "@ionic-native/local-notifications": "^5.2.0",
        "@ionic-native/network": "4.5.3",
        "@ionic-native/qr-scanner": "^4.7.0",
        "@ionic-native/safari-view-controller": "^4.7.0",
        "@ionic-native/screen-orientation": "4.5.3",
        "@ionic-native/splash-screen": "4.5.3",
        "@ionic-native/sqlite": "4.5.3",
        "@ionic-native/status-bar": "4.5.3",
        "@ionic-native/vibration": "^4.7.0",
        "@ionic/storage": "^2.2.0",
        "@nguniversal/express-engine": "^7.0.2",
        "@ngx-translate/core": "9.1.1",
        "@ngx-translate/http-loader": "2.0.1",
        "@types/lodash": "^4.14.109",
        "angular-2-local-storage": "^2.0.0",
        "angular2-moment": "^1.9.0",
        "bootstrap-sass": "^3.3.7",
        "chart.js": "2.7.1",
        "cordova-android": "7.1.4",
        "cordova-browser": "5.0.4",
        "cordova-ios": "4.5.5",
        "cordova-plugin-add-swift-support": "^1.7.2",
        "cordova-plugin-background-mode-bluetooth-central": "~1.0.0",
        "cordova-plugin-bluetooth-peripheral-usage-description": "^1.0.0",
        "cordova-plugin-bluetoothle": "~4.5.3",
        "cordova-plugin-customurlscheme": "^4.3.0",
        "cordova-plugin-inappbrowser": "^2.0.2",
        "cordova-plugin-network-information": "^2.0.1",
        "cordova-plugin-qrscanner": "^2.6.0",
        "cordova-plugin-safariviewcontroller": "^1.5.4",
        "cordova-plugin-screen-orientation": "^3.0.1",
        "cordova-plugin-splashscreen": "^5.0.2",
        "cordova-plugin-statusbar": "^2.4.1",
        "cordova-plugin-vibration": "^3.1.0",
        "cordova-plugin-whitelist": "^1.3.3",
        "cordova-sqlite-storage": "^2.2.1",
        "de.appplant.cordova.plugin.local-notification": "^0.8.5",
        "es6-promise-plugin": "^4.2.2",
        "fast-json-patch": "2.0.6",
        "flag-icon-css": "3.0.0",
        "immutable": "^3.8.2",
        "ionic-angular": "3.9.4",
        "ionic-plugin-deeplinks": "^1.0.17",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "ios-sim": "^6.1.2",
        "list": "^2.0.13",
        "lodash": "^4.17.10",
        "ngx-cookie": "^4.1.2",
        "ngx-order-pipe": "^2.0.1",
        "rxjs": "5.5.6",
        "zone.js": "0.8.20"
    },
    "devDependencies": {
        "@angular/cli": "^7.3.0",
        "@ionic/app-scripts": "3.2.3",
        "postcss": "6.0.14",
        "typescript": "^2.7.2"
    },
    "cordova": {
        "platforms": [
            "android",
            "ios",
            "browser"
        ],
        "plugins": {
            "cordova-plugin-network-information": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-sqlite-storage": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-screen-orientation": {},
            "cordova-plugin-inappbrowser": {},
            "cordova-plugin-vibration": {},
            "cordova-plugin-customurlscheme": {
                "URL_SCHEME": "printixapp",
                "ANDROID_SCHEME": " ",
                "ANDROID_HOST": " ",
                "ANDROID_PATHPREFIX": "/"
            },
            "cordova-plugin-qrscanner": {},
            "cordova-plugin-whitelist": {},
            "cordova-plugin-safariviewcontroller": {},
            "cordova-plugin-background-mode-bluetooth-central": {},
            "cordova-plugin-bluetooth-peripheral-usage-description": {
                "TEXT": "plugin for using bluetooth on ios"
            },
            "de.appplant.cordova.plugin.local-notification": {},
            "cordova-plugin-bluetoothle": {}
        }
    }
}

Ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.2.3
    Cordova Platforms  : android 7.1.4 browser 5.0.4 ios 4.5.5
    Ionic Framework    : ionic-angular 3.9.4

System:

    ios-deploy : 1.9.2 
    ios-sim    : 6.1.3 
    Node       : v8.11.1
    npm        : 5.6.0 
    OS         : macOS High Sierra
    Xcode      : Xcode 10.1 Build version 10B61 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

1 Like

Hi gambarle, I have the same problem, but in my case I can build the app properly but when I initialize on mobile stucks and debugging I found the same error ‘cannot find module “.”’. Did you find the solution? If I resolve I’ll post here.

Thanks in advance

Thanks for the reply,

I have unfortunately not found a solution to the issue, and I am continuously running my code without the --aot flag.

I will also update if I solve the issue.

Although this may sound like a daunting task, I would recommend auditing every one of your import statements. I believe one of them is causing this. Especially focus on those involving unusual libraries (i.e. not Ionic or Angular direct dependencies).

1 Like

Hi again,

Sorry for the late reply. I really don’t know the reason and I don’t remember where I found the solution, but I solve the problem downgrading typescript to 2.8.3 version.

I hope this can solve your issue too