Skip to content

fix(schematics): continue traversing within irrelevant PropertyAssignment nodes#215

Merged
vsavkin merged 1 commit intomasterfrom
affected-apps-fix
Jan 19, 2018
Merged

fix(schematics): continue traversing within irrelevant PropertyAssignment nodes#215
vsavkin merged 1 commit intomasterfrom
affected-apps-fix

Conversation

@JamesHenry
Copy link
Copy Markdown
Contributor

Currently recursive traversal of the TS AST generated for each file within an app is being prematurely stopped for PropertyAssignment nodes which are not relevant to dependency resolution.

Taking an example of a lib called safe, which has a module called HistorySearchModule.

Before this PR, Nx would successful pick up on the safe lib as a dependency of the app if the code was written like this:

// imports etc..

const routes = [
  {
    path: '',
    loadChildren: '@libs/safe/history-search#HistorySearchModule'
  }
]

@NgModule({
  imports: [
 //...
    RouterModule.forRoot(
      routes,
      { useHash: true }
    ),
  ],
 //...
})
export class AppModule {}

But not if it was written like this:

// imports etc..

@NgModule({
  imports: [
 //...
    RouterModule.forRoot(
      [
          {
              path: '',
              loadChildren: '@libs/safe/history-search#HistorySearchModule'
          }
      ],
      { useHash: true }
    ),
  ],
 //...
})
export class AppModule {}

I refactored the code slightly and added some comments to try and make the behaviour a little clearer.

@JamesHenry JamesHenry requested a review from vsavkin January 19, 2018 18:55
@vsavkin vsavkin merged commit 2293e28 into master Jan 19, 2018
@vsavkin vsavkin deleted the affected-apps-fix branch June 19, 2019 20:38
FrozenPandaz added a commit to FrozenPandaz/nx that referenced this pull request Jan 12, 2023
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants