Angular2 CLI Build Prod build error: call function "NoOpAnimationDriver", function calls are not supported

When I switched to using @ angular 2.4.4, I started getting the error below. When will I get back to @angular 2.2.1. I can build without problems.

When using angular 2.4.4, I can still run my program locally using "npm start".

Only when I try to run the build using "ng build -prod -aot" do I get an error.

As far as I can tell, I am not using the "NoOpAnimationDriver" or the "BrowserTestingModule", which are both referenced in error.

I hope someone saw this error earlier and could tell me the following: 1. what the error actually says. 2. Why do I get an error in functions that I do not use. 3. How can I fix the error. 4. where I could find additional information on how to understand such errors.

ERROR in 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 c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in c:/Development/SentriKeyApp/node_modules/@angular/platform-browser/testing/browser.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'c:\Development\SentriKeyApp\src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve 'c:\Development\SentriKeyApp\src\$$_gendir' in 'c:\Development\SentriKeyApp\node_modules\@angular\core\src\linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 71:15-36 87:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main
+4
source share
3 answers

The next error is a compiler error in advance.

Error: The error detected static character resolution values. function calling, function calls are not supported. Consider replacing a function or lambda with a reference to the exported Function

Before:

const declarations = () => [
  SomeComponent
];
@NgModule({
  declarations: declarations(),
})
export class SomeModule {}

After:

export function declarations() {
  return [
    SomeComponent
  ];
}
@NgModule({
  declarations: declarations(),
})
export class SomeModule {}

https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.let72omre

-prod ng build Ahead of Time. - .28. . :

https://github.com/angular/angular-cli/blob/master/CHANGELOG.md

+1

ng build --prod --aot, , .

ng build --prod --aot false, Ahead of the Time

+1

see this blog, you will find the answer Get your angular 2 ready for aot and this

0
source

Source: https://habr.com/ru/post/1667587/


All Articles