TypeError: Cannot read property 'content' of undefined

Possible Solution

I believe a webpack plugin decided to no longer accepts my declaration files that had the extension .d.ts. I had a file with only type annotations named user.d.ts and I was forced to rename it to user.ts. This allowed me to get passed the error.

More Insight

I had the same error where Module build failed: TypeError: Cannot read property 'content' of undefined.

I didn’t change any of my code, this only happened after I updated @ionic/app-scripts@2.1.4. I also tried @ionic/app-scripts@2.0.2 and got the same error.

While ionic-app-scripts serve worked flawlessly, ionic-app-scripts build --prod --release stopped working.

“Properly” downgrading or updating to different versions Angular, Ionic-Angular,and @angular/cli didn’t fix the error. I was using the current versions.

  • @angular/common@4.3.6
  • Ionic-Angular@3.6.1
  • @angular/cli@1.4.3

Ionic Info:

@ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.6.1

System:

    Android SDK Tools : 25.2.3
    Node              : v7.4.0
    npm               : 4.0.5
    OS                : Windows 10