My project builds with webpack but when I host the app from localhost I get an error.
Uncaught ReferenceError: __decorate is not defined.
Initially i get the error with the Injectable() decorator. But when I uncomment that I get the same error but with extends.
Ive created a repo that duplicates the errors.
https://github.com/shawnrmoss/decorators
I suspect it has something to do with typings since the problem started when I had to change those definitions.
typings_orig.json has the original typings definitions
Im no sure what is going on. Hopefully someone can shine a light on this and help me out.
Thanks.
I think you don't import include the Reflect-metadata library into your project. This library is provided by Angular thanks to the
angular2-polyfills.js
file. This library contains both ZoneJS and Reflect-metadata.This library is used by decorators, specially the
@Injectable
one. They internally use theReflect.decorate
function.From your comment, it seems that you only import es6-promise and zone-microtask...
This article could help you and look for
Reflect.decorate
: