Search code examples
angularangular2-universal

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


Solution

  • 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.