-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(aot):export default routes array to work with AoT compiler #2680
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
Can you please create an e2e test to verify? |
Hmm. Can you help me with planning this one? I'm not sure what the e2e test would do, given:
|
I had a thought that maybe I can test that But then I looked at the e2e tests (in Am I missing something, or would this be good to go? Thanks a lot. |
Heya @Meligy, could you give me some more context on the issue that the PR aims to resolve? That sounds like a AoT compiler limitation, but one that I was not aware of. Is there an issue on angular/angular maybe? Regarding tests, our test infrastructure just restores everything after each test, so you should be fine manually creating some files and replacing the import statement. An example of something of this sort can be found in https://github.com/angular/angular-cli/blob/master/tests/e2e/tests/build/styles/scss.ts |
When you don't export the
There`re several related issues in the @angular/angular repository. I can't seem to find the most accurate issue unfortunately. I have a simple repro at @Meligy/routing-angular-cli. FYI, this only solves build issues (output when you run the command). AoT routing (components, bundling other modules, and lazy loaded modules) is broken in runtime still (browser console), which I'm working on improving my repro to show all cases, and then will see if I can add to existing issue or create new one for. |
e29a2e7
to
45714c2
Compare
The problem this PR fixes seems to be gone in Angular 2.1.0, so, I'm closing this PR. The problem explained in #2735 though is still there. The difference if not clear is:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The AoT compiler needs the variables used in the
@NgModule
declaration to be exported as well.This doesn't fail when the array is empty (come compiler optimization magic maybe?), but as soon as the user enters their first route into the array, their first experience with AoT becomes an error. So, this improves the default to be compatible with AoT compiler from the beginning.