I'm trying to build my project which works fine when I'm just running it locally with ng serve
.
but on ng b -prod
I get :
ERROR in app\logged-in\content\routing\routing.component.ts(9,16): Error during template compile of 'RoutingComponent'
[ERROR] Function expressions are not supported in decorators in 'slideLeft'
[ERROR] 'slideLeft' references 'ɵ0'
[ERROR] 'ɵ0' contains the error at assets\animations\router.animations.ts(2,15)
[ERROR] Consider changing the function expression into an exported function.
here's the file being loaded :
import {sequence, trigger, animate, style, group, query as q, transition, animateChild} from '@angular/animations';
const query = (s,a,o={optional:true})=>q(s,a,o);
export const slideLeft = trigger('slideLeft', [
transition('* => *', [
query(':enter, :leave', style({ position: 'fixed', width:'100%' })),
query(':enter', style({ transform: 'translateX(100%)' })),
sequence([
query(':leave', animateChild()),
group([
query(':leave', [
style({ transform: 'translateX(0%)' }),
animate('1s cubic-bezier(.86,.01,.27,1)',
style({ transform: 'translateX(-100%)' }))
]),
query(':enter', [
style({ transform: 'translateX(100%)' }),
animate('1s cubic-bezier(.86,.01,.27,1)',
style({ transform: 'translateX(0%)' })),
]),
]),
query(':enter', animateChild()),
])
])
]);
and here's the component that loads it :
import {Component, OnInit} from '@angular/core';
import {slideLeft} from '../../../../assets/animations/router.animations';
import {Router} from '@angular/router';
@Component({
selector: 'app-routing',
templateUrl: './routing.component.html',
styleUrls: ['./routing.component.scss'],
animations: [slideLeft]
})
export class RoutingComponent implements OnInit {
router:Router;
constructor() {}
ngOnInit() {}
getState(outlet) {
return outlet.activatedRouteData.state;
}
}
what's wrong here?
I found this issue: https://github.com/angular/angular/issues/10789 is it the problem I'm having?