Skip to content
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

Import path duplication in module when generating component using '@nrwl/angular:component' schematics #16493

Closed
geraldcsoftware opened this issue Apr 24, 2023 · 2 comments

Comments

@geraldcsoftware
Copy link

Current Behavior

When generating a component using "@nrwl/angular:component" schematics, the import path in the module has a duplication of the component directory.

For example, generating a component using nx g @nrwl/angular:component test gives import { TestComponent } from './test/test/test.component'; in the declaring module. Note the duplicate '/test' in the path, which makes the import path wrong.

Expected Behavior

The import path should be generated correctly.

GitHub Repo

https://github.com/geraldcsoftware/nx-examples

Steps to Reproduce

  1. Run npx create-nx-workspace@latest --name myworkspace --preset angular-monorepo --appName myapp
  2. Execute nx g @nrwl/angular:component test --project myapp

The app module will have the import path
import { TestComponent } from './test/test/test.component';
instead of
import { TestComponent } from './test/test.component';
image

Nx Report

Node : 18.16.0
   OS   : win32 x64
   npm  : 9.6.4
   
   nx (global)             : 15.9.2
   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/angular           : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/web               : 15.9.2
   @nrwl/webpack           : 15.9.2
   typescript              : 4.9.5

Failure Logs

No response

Additional Information

Using @schematics/angular, the generated import path is correct.

E.g. running nx g @schematics/angular:component test gives the import path
import { TestComponent } from './test/test.component';

@leosvelperez
Copy link
Member

Thanks for reporting this!

This was already fixed in #16364 and the change should be released soon. Please keep an eye on the releases to get the fix.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants