I'm trying to use the Angular Template Compiler just to investigate it, I know it's in early stages but the documentation for RC5 is mentioning it already. I created a small "hello, world" project and I can run ngc
, but it never produces the .ngFactory.ts
files, I only see a .metadata.json
file.
You can see it by cloning the angular 2 quickstart. Running $(npm bin)/tsc
works fine and compiles the typescript in the 'app' directory to javascript with map files.
Next I followed the instructions and installed node modules (upgrading typescript):
npm install --save @angular/compiler-cli typescript@next
@angular/platform-server @angular/compiler
Now running $(npm bin)/tsc
still works and produces .js
and .js.map
files. I delete those files and run $(npm bin)/ngc
and it produces the .js
and .js.map
files, along with two new files:
app.component.metadata.json
app.module.metadata.jason
It looks like those files contain metadata from the decorators basically:
{"__symbolic":"module","version":1,"metadata":{"AppComponent":
{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":
{"__symbolic":"reference","module":"@angular/core","name":"Component"},
"arguments":[{"selector":"my-app","template":
"<h1>My First Angular 2 App</h1>"}]}]}}}
But ngc
produces no output to the console, and I don't see any ngFactory
files that should be there. Originally typescript@next gives me 2.1.0-dev.20160813, and packages say unmet peer dependency expecting 1.9.0 so I install 1.9.0-dev.20160627-1.0 but I get the same result. I've also tried $(npm bin)/ngc -p .
which does the same thing and $(npm bin)/ngc -p app
which gives a bunch of errors because it can't find the core-js types (Promise, Set, Map, etc.).