Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIn app.module place the app.component import last #16598
Comments
I think that makes sense. I'd even move the non-local imports all the way to the top. Would you like to implement this change? |
hey,
|
Heya @zadokdaniel, thanks for taking a look! So this happens on a generator, and generators are relatively easy to test which makes it easier to work on. All generators are in https://github.com/angular/angular-cli/tree/master/packages/schematics, and have unit tests. The unit tests can be ran with The first thing is to figure out which generator does it and reproduce the problem. The issue report didn't actually include that. @fireflysemantics what was the command you used when you saw this happening? Can you also provide the result of |
@filipesilva Hello, What are trying to solve here? In the original issue only app.component is mentioned. Are we trying to move all non-local imports to top? |
@krishnaanaril yes, that is the idea. The way we add these imports is by reading the source file AST and inserting new imports in the appropriate place. So the algorithm we use to do that would need to handle local/non-local better. I'm still not sure in what situations this occurs so it's also important to isolate the problematic insertions. |
Is anyone working on this? |
I have not encountered this being an issue with other developers. Am I reading this right that this to to make copy/paste easier? |
Hi - Sorry for the late reply - Just saw the other comments now. After having done a few more project I've started to always just delete the routing module and place the routes directly into the app module. This is easier because the app module has to have all the components for declaration anyways, so it's just easier to define the routes there too. I wonder if creating a separate routing module should be an option on the |
--------answer |
|
In order to make it easier to cut and paste component imports in the router module, Instead of:
Do