-
Notifications
You must be signed in to change notification settings - Fork 875
Conversation
9404fbc
to
3d187c3
Compare
This is still pending angular/in-memory-web-api#36, but here is my first stab at supporting both AoT and JiT in the same code base. We can improve on this, but this is at least a starting point. AoT There is no source code in the new project, but there is a new index.html file pointing to the generated bundle. The bundle is generated from the source in the original toh-6 folder. Trigger a build by running JiT @wardbell @johnpapa @brandonroberts @Foxandxss @filipesilva cc: @robwormald |
9cbfeeb
to
c7cf95b
Compare
I made a few tweaks based on discussions with @wardbell Instead of adding a new tsconfig.json I have made a few tweaks to the shared config The remaining part for this cookbook is to add a section to the prose. |
@thelgevold I've reviewed your files and have a few questions:
I'm also thinking of generalizing this approach to run AoT over all of our examples in a separate e2e CI instance. |
c7cf95b
to
b4310d9
Compare
@filipesilva The third tsconfig is obsolete now, so I have deleted it. |
Addressing lazy loading separately is fine by me, just wanted to confirm. |
@wardbell I have updated the prose and removed the WIP part of the title. |
a92330e
to
c824c40
Compare
@@ -12,7 +12,7 @@ import { HttpModule } from '@angular/http'; | |||
|
|||
// #enddocregion v1 | |||
// Imports for loading & configuring the in-memory web api | |||
import { InMemoryWebApiModule } from 'angular-in-memory-web-api'; | |||
import { InMemoryWebApiModule } from 'angular-in-memory-web-api/in-memory-web-api.module'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we have to import this way instead of just importing from angular-in-memory-web-api
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason we get an issue with rollup not finding the module if we rely on just the barrel. If I give it the fully qualified name like this it works. It's a bit odd, but seems to be a rollup thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. It should be noted as a caveat to rollup if this is not the way it has to be done normally unless we figure out a way to use the barrel export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this is happening because the code is already converted to JavaScript by the time it enters the rollup world. I guess the barrel is transpiled as well, but maybe Rollup isn't considering the convention of using barrels...
|
||
Tour of Heroes has an external dependency on the `angular-in-memory-web-api` library. | ||
|
||
We can't expect all libraries to be released with AoT in mind, but `angular-in-memory-web-api` has already been AoT compiled and released with the necessary dependencies to integrate it with another AoT compiled application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should expect this since one non-AoT provided library prevents AoT altogether. Maybe that is addressed in a separate cookbook on creating a third party library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm..Does this mean that any third part angular lib has to be AoT-ed for AoT to work? We are integrating rxjs which is non-AoT, but that is not Angular....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean in the context of the Angular world. Any third-party library that provides an NgModule/Component would need to be AoT compiled for the host application to be able to use it with AoT.
Third-party libraries that aren't Angular-specific would not need to be AoT compiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree that we should have a separate cookbook talking about creating third party libraries. I removed the sentence that said we shouldn't expect AoT since it seems to be a prerequisite.
c824c40
to
fb20888
Compare
b7b71cb
to
f6c21a7
Compare
I am rebasing and reviewing and will force push so beware |
93c55b9
to
187797c
Compare
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
d33808a
to
f7b3c50
Compare
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
@thelgevold there were a few setup changes in #2233, which went in yesterday. When rebasing pay special attention to Since you create new tsconfigs for your examples you must add this property, otherwise you will get a lot of duplicate identifier errors. |
The only item I am not clear on is the |
754056b
to
b701379
Compare
I have fixed the typings issue and renamed the rollup.js file to rollup-config.js |
should it be |
I think either will work. My impression is that on windows it can't be named the same as the binary (rollup) |
5cc6145
to
6fa0a05
Compare
I switched to using the AppRouterModule and there were no issues with AoT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed my issues. Thanks!
We should make sure the cookbook prose and code samples are updated too. |
@@ -74,6 +74,7 @@ | |||
"raw-loader": "^0.5.1", | |||
"rimraf": "^2.5.4", | |||
"rollup-plugin-commonjs": "^4.1.0", | |||
"source-map-explorer": "^1.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this in the examples? its cool but are we using it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the prose talks about how to use it, so I think it makes sense to install it with the sample
3403364
to
7aeee03
Compare
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
7aeee03
to
003973b
Compare
Updates tooling for this purpose and also the prose.
003973b
to
d1c3c9c
Compare
I've extended the gulpfile's e2e facility so it can run the same e2e.specs against the AoT build of an app when It's primitive and rigid but it works as seen in the toh-6 in his PR. That means no need for a separate aot project folder (toh-6-aot is gone). The "trick" is that the AoT version of the Still don't have a good way to demonstrate this to our readers. The instructions in the prose describe what to do if you've cloned the repo. |
Tor says: "... AoT CB is ready to go"