Error running app after upgrading to Ionic RC4

216 Views Asked by At

I'm having a hard time running my app after upgrading from Ionic rc3 to rc4.

When I build the app by running ionic-app-scripts build --prod it compiles fine without any errors.

But when I run the app on my iPhone, I get a blank screen and the following error in the Safari Console:

Error: Module build failed: TypeError: Cannot set property 'sources' of undefined
at /Users/andreas/IdeaProjects/project/node_modules/@ionic/app-scripts/dist/webpack/loader-impl.js:35:37

It seemed to be related to the sourcemap generation, so I tried turning it off, but that didn't help. ionic-app-scripts build --prod --generateSourceMap=false

I then create a blank app and it worked just fine. So there seems to be a problem with my app specifically. However, I have no idea where I have to start debugging this error. I already tried to adjust the file where I got the error, but that also didn't help (and it wouldn't be a clean solution either).

Any help is appreciated.

EDIT: I didn't see the breaking changes in the ionic-app-scripts. I had to alter the tsconfig.json, now I get a new error:

Uncaught Error: Cannot find module "./app.module.ngfactory"

1

There are 1 best solutions below

0
On BEST ANSWER

Apparently ionic-app-scripts is having issues with Typescript 2.1 and above. If you started building your app before rc2, you will have Typescript version "^2.0.3" in your package.json. Simply change it to "2.0.x" and run npm i.