This service doesn't have any dependencies to Ionic itself, only to some Angular packages.
Since Ionic 2.2 uses newer versions of Angular (2.4.8 instead of 2.2.1), I updated the
Angular dependencies to the new versions. And then, ngc didn't work anymore. I got a strange error:
Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in .../ionic-configuration-service/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in .../ionic-configuration-service/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in .../ionic-configuration-service/node_modules/@angular/platform-browser/testing/browser.d.tsThe error message was not very helpful, also Google did not provide a lot of information.
I found only some posts from end of last year.
The solution was - finally - quite easy. I had to add a specific
tsconfig.aot.json, which is used by ngc.The differences to the original
tsconfig.json are:{
"compilerOptions": {
"module": "es2015"
},
"files": [
"src/index.ts"
],
"angularCompilerOptions": {
"genDir": "aot"
}
}
modulees2015is needed for tree shakingfilesdefines the entry pointgenDirspecifies where ngc stores its intermediate files
ngc to use the new configuration:ngc -p tsconfig.aot.jsonFor a detailed explanation, just check the Angular Cookbook.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.