Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 reflect-metadata shim is required when using class decorators

I’m trying to use the universal starter example to learn more about server rendering with Angular2, I want to use gulp instead of webpack. The problem is when the server start I have :

/Users/jaumard/IdeaProjects/trails-angular2-isomorphic/node_modules/@angular/core/src/util/decorators.js:165
        throw 'reflect-metadata shim is required when using class decorators';
        ^
reflect-metadata shim is required when using class decorators

I see some posts who said to add import 'reflect-metadata'; but that doesn’t fix the issue for me :( I think I miss something but can’t figure what it is... Here is the code I use https://github.com/jaumard/trails-angular2-isomorphic

like image 243
jaumard Avatar asked May 29 '16 11:05

jaumard


1 Answers

In fact the import 'reflect-metadata'; have to be added on my server.ts file as I want to use server rendering. After adding it. No more errors.

like image 163
jaumard Avatar answered Sep 21 '22 14:09

jaumard