angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

TypeError: dirMeta.animations.map is not a function

Open m4mbart opened this issue 10 years ago • 7 comments

Hi,

When I try building with the --aot flag I get this error:

dirMeta.animations.map is not a function TypeError: dirMeta.animations.map is not a function at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (/node_modules/@angular/compiler/bundles/compiler.umd.js:14515:38) at CompileMetadataResolver._loadDirectiveMetadata (/node_modules/@angular/compiler/bundles/compiler.umd.js:14446:44) at ***/node_modules/@angular/compiler/bundles/compiler.umd.js:14712:89 at ***/node_modules/@angular/compiler/bundles/compiler.umd.js:12714:153 at Array.map (native) at /node_modules/@angular/compiler/bundles/compiler.umd.js:12714:122 at Array.map (native) at loadNgModuleDirectives (/node_modules/@angular/compiler/bundles/compiler.umd.js:12714:46)

Any thoughts at what might be wrong with my project here?

OS

macOS Sierra

Versions.

angular-cli: 1.0.0-beta.21 node: 6.9.1 os: darwin x64

Repro steps.

Updated from beta-17 to beta-20.1 to beta-21. AoT never worked for me, but I fixed a lot of issues (like functions for factories) but this error is quite new. It was also there in beta-20.1

m4mbart avatar Nov 25 '16 10:11 m4mbart

Weird stuff. If you can get me a simple barebones repo, I can take a look.

filipesilva avatar Dec 29 '16 20:12 filipesilva

Closed as inactive.

filipesilva avatar Jan 24 '17 18:01 filipesilva

I seem to have the same thing with beta 31, do you know what resolved it @m4mbart ?

https://github.com/angular/angular-cli/issues/5169

AshMcConnell avatar Mar 02 '17 10:03 AshMcConnell

Hi, the problem came from animation instructions that were shared by multiple components and that were imported from a static property on one common abstract component.

AoT did not seem to resolve these animations correctly. Now I declare my shared animations as an exported constant value like this:

export const default_animations: AnimationEntryMetadata[] = [ trigger(...) ];

And import it in another component like this:

@Component({ ... animations: default_animations }) export class SomeComponent {

Basically it boils down to AoT not being able to resolve stuff. And that is all very much dependent on exports.

m4mbart avatar Mar 02 '17 11:03 m4mbart

We haven't intentionally done any animation, but perhaps some 3rd party components do. What do you mean by animation instructions? Is there a keyword we should search for? I tried searching for animations: but no hits.

Thanks!

AshMcConnell avatar Mar 02 '17 11:03 AshMcConnell

Ah, there was some animation stuff in there from a 3rd party - removed it (for the moment) and all built ok. Thanks again!

AshMcConnell avatar Mar 02 '17 11:03 AshMcConnell

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.