cannot determine the module for component angular 5

后端 未结 12 1985
太阳男子
太阳男子 2020-12-29 20:39

I\'m getting following error when I build the Angular app using \"ng build --prod\". This is working when I build with Angular 4 and getting error with Angular 5. With Angul

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 21:12

    I had exactly the same issue and can offer a workaround although not sure why this specific pipe is not being successfully picked up by the aot build:

    Workaround

    Copy the time-ago-pipe.ts from node_modules/time-ago-pipe and just copy this file into your own project.

    Add it to your declarations in your module as normal and import this into your imports e.g:

    import { TimeAgoPipe } from './_pipes/time-ago-pipe';
    

    This will then compile successfully in AOT build and you can still use the pipe.

提交回复
热议问题