I'm trying to build a small angular2 application: I am not using TypeScript, but rather regular ES6 with babel
my files look like this:
//mycomponent.js import { Component, View } from 'angular2/angular2'; @Component({ selector: 'my-app' }) @View({ template: '<h1>My First Angular 2 App</h1>' }) class MyComponent { constructor() { } get prop() { return 'hello'; } } export { MyComponent }; // index.js import 'zone.js'; import 'reflect-metadata'; import { MyComponent } from './mycomponent'; import { bootstrap } from 'angular2/angular2'; bootstrap(MyComponent);
this is then compiled using webpack using babel-loader with two presets enabled ['es2015', 'stage-1']
when launched in a browser, this causes the following error:
EXCEPTION : error creating Token Promise !.
ORIGINAL EXCLUSION : directive annotations not found on MyComponent
I tried explicitly adding @Directive() annotation to MyComponent, but this had no effect.
ecmascript-6 angular webpack
dark_ruby
source share