My code works fine with ng build
and ng build --prod
howerver, when I add --aot to the command, it fails with the following error:
Uncaught Error: Module build failed: Error: C:/Users/dremache/Code/control-f2/client/src/app/transitions.ts (11,14): Exported variable 'pageTransitions' has or is using name 'AnimationEntryMetadata' from external module "C:/Users/dremache/Code/control-f2/client/node_modules/@angular/core/src/animation/metadata" but cannot be named.)
This is transitions.ts:
import { trigger,
state,
style,
transition,
animate,
keyframes } from '@angular/core';
export const pageTransitions =
trigger('slideInOut', [
state('in', style({transform: 'translateX(0)'})),
transition('void => *', [
style({transform: 'translateX(-60px)',opacity: '0'}),
animate('300ms ease-out')
]),
transition('* => void', [
animate('300ms ease-out', style({transform: 'translateX(-60px)'}))
])
]);
This is the component that's importing it:
//other imports
import { pageTransitions } from './transitions';
@Component({
//other properties
animations: [ pageTransitions,
trigger('items', [
// states and transitions here.. removing for cleanliness
]
})
Any ideas? I'm doing this to avoid re-defining the same animations. These animations are being applied on components that are going from void => *
to create page transition animations.
Fixed it!
In my transitions.ts file I needed to change:
export const pageTransitions =
to:
export const pageTransitions: AnimationEntryMetadata =
(as well import AnimationEntryMetadata
from @angular/core
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With