我的代码可以正常工作ng build
and ng build --prod
但是,当我将 --oat 添加到命令中时,它会失败并出现以下错误:
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 转换.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 => *
创建页面过渡动画。