Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule'

Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule'


Above is the error we got while building the angular application using ng build --prod

Many times we add the different type dependencies in our application to get our work done and run our program very easily but go wrong sometimes when we try to build our angular application.


Above error, that is - "Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule'" is mostly occurs because of the path of imports. In our case, we have installed 
ng-pick-datetime-moment and used module OwlMomentDateTimeModule in the angular app and to use this module we have to import it into our module like

import { OwlMomentDateTimeModule } from 'ng-pick-datetime-moment';

It worked fine when we are running our angular application, But because of this is a relative path, we got the above error while building the application, so to avoid that we have given full path of the moment module in our user-defined module(like app.module.ts). following is the full path

import { OwlMomentDateTimeModule } from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';


And that's it, it just running fine as well as we don't have the problem in building the app using ng build --prod command.

I hope this is helpful to you.

Thank you.

[ If you are preparing for an interview please click here - angular interview questions and answers ]

Comments