我的代碼工作正常ng build
和ng build --prod
howerver,當我--aot添加到命令時,出現以下錯誤:角2 --aot導致AnimationEntryMetadata失敗
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.)
這是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)'}))
])
]);
這就是會導入它的成分:
//other imports
import { pageTransitions } from './transitions';
@Component({
//other properties
animations: [ pageTransitions,
trigger('items', [
// states and transitions here.. removing for cleanliness
]
})
任何想法?我這樣做是爲了避免重新定義相同的動畫。這些動畫正在應用於從void => *
開始創建頁面過渡動畫的組件。
尼斯,FYI爲角4+它的現在'AnimationTriggerMetadata' – Chrillewoodz